[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/extensions/extension_install_prompt.h" |
| 6 | |
| 7 | #include <map> |
| 8 | |
| 9 | #include "base/command_line.h" |
[email protected] | b19fe57 | 2013-07-18 04:54:26 | [diff] [blame] | 10 | #include "base/message_loop/message_loop.h" |
[email protected] | 3853a4c | 2013-02-11 17:15:57 | [diff] [blame] | 11 | #include "base/prefs/pref_service.h" |
[email protected] | 3ea1b18 | 2013-02-08 22:38:41 | [diff] [blame] | 12 | #include "base/strings/string_number_conversions.h" |
[email protected] | 00e7bef | 2013-06-10 20:35:17 | [diff] [blame] | 13 | #include "base/strings/string_util.h" |
| 14 | #include "base/strings/stringprintf.h" |
[email protected] | 112158af | 2013-06-07 23:46:18 | [diff] [blame] | 15 | #include "base/strings/utf_string_conversions.h" |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 16 | #include "chrome/browser/extensions/bundle_installer.h" |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 17 | #include "chrome/browser/extensions/extension_install_ui.h" |
[email protected] | 7eb20e3 | 2014-04-30 08:50:56 | [diff] [blame^] | 18 | #include "chrome/browser/extensions/extension_util.h" |
[email protected] | ec7de0c5a | 2012-11-16 07:40:47 | [diff] [blame] | 19 | #include "chrome/browser/extensions/image_loader.h" |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 20 | #include "chrome/browser/profiles/profile.h" |
[email protected] | 4f3fb35 | 2013-07-17 04:07:01 | [diff] [blame] | 21 | #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
[email protected] | 32fc4ff7 | 2012-06-15 21:50:01 | [diff] [blame] | 22 | #include "chrome/browser/ui/browser.h" |
[email protected] | 619f8618 | 2012-07-03 21:30:18 | [diff] [blame] | 23 | #include "chrome/browser/ui/browser_window.h" |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 24 | #include "chrome/common/chrome_switches.h" |
[email protected] | 29e0c4e7 | 2013-02-01 04:42:56 | [diff] [blame] | 25 | #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" |
[email protected] | fc507794 | 2012-08-15 21:37:59 | [diff] [blame] | 26 | #include "chrome/common/pref_names.h" |
[email protected] | 7274ef0 | 2014-03-24 22:43:40 | [diff] [blame] | 27 | #include "components/signin/core/browser/profile_oauth2_token_service.h" |
[email protected] | 91e51d61 | 2012-10-21 23:03:05 | [diff] [blame] | 28 | #include "content/public/browser/web_contents.h" |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 29 | #include "content/public/browser/web_contents_view.h" |
[email protected] | cda103d | 2014-04-04 16:22:39 | [diff] [blame] | 30 | #include "extensions/common/constants.h" |
[email protected] | e4452d3 | 2013-11-15 23:07:41 | [diff] [blame] | 31 | #include "extensions/common/extension.h" |
[email protected] | 4b790884 | 2014-04-07 23:50:22 | [diff] [blame] | 32 | #include "extensions/common/extension_icon_set.h" |
[email protected] | 993da5e | 2013-03-23 21:25:16 | [diff] [blame] | 33 | #include "extensions/common/extension_resource.h" |
[email protected] | 5ef835a | 2013-11-08 20:42:57 | [diff] [blame] | 34 | #include "extensions/common/feature_switch.h" |
[email protected] | d42c1115 | 2013-08-22 19:36:32 | [diff] [blame] | 35 | #include "extensions/common/manifest.h" |
[email protected] | 6bf9061 | 2013-08-15 00:36:27 | [diff] [blame] | 36 | #include "extensions/common/manifest_constants.h" |
[email protected] | 0db486f | 2014-04-09 19:32:22 | [diff] [blame] | 37 | #include "extensions/common/manifest_handlers/icons_handler.h" |
[email protected] | c4100347 | 2013-10-19 15:37:25 | [diff] [blame] | 38 | #include "extensions/common/permissions/permission_message_provider.h" |
[email protected] | 5a55f3f | 2013-10-29 01:08:29 | [diff] [blame] | 39 | #include "extensions/common/permissions/permission_set.h" |
[email protected] | e4452d3 | 2013-11-15 23:07:41 | [diff] [blame] | 40 | #include "extensions/common/permissions/permissions_data.h" |
[email protected] | 885c0e9 | 2012-11-13 20:27:42 | [diff] [blame] | 41 | #include "extensions/common/url_pattern.h" |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 42 | #include "grit/chromium_strings.h" |
| 43 | #include "grit/generated_resources.h" |
[email protected] | 2a28133 | 2012-07-11 22:20:23 | [diff] [blame] | 44 | #include "grit/theme_resources.h" |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 45 | #include "ui/base/l10n/l10n_util.h" |
| 46 | #include "ui/base/resource/resource_bundle.h" |
| 47 | #include "ui/gfx/image/image.h" |
| 48 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 49 | using extensions::BundleInstaller; |
| 50 | using extensions::Extension; |
[email protected] | 1d5e58b | 2013-01-31 08:41:40 | [diff] [blame] | 51 | using extensions::Manifest; |
[email protected] | c2e66e1 | 2012-06-27 06:27:06 | [diff] [blame] | 52 | using extensions::PermissionSet; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 53 | |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 54 | namespace { |
| 55 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 56 | static const int kTitleIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { |
| 57 | 0, // The regular install prompt depends on what's being installed. |
| 58 | IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, |
| 59 | IDS_EXTENSION_INSTALL_PROMPT_TITLE, |
| 60 | IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 61 | IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE, |
| 62 | IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_TITLE, |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 63 | IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_TITLE, |
[email protected] | 1a93d8d | 2013-10-27 23:09:20 | [diff] [blame] | 64 | IDS_EXTENSION_LAUNCH_APP_PROMPT_TITLE, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 65 | }; |
| 66 | static const int kHeadingIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { |
| 67 | IDS_EXTENSION_INSTALL_PROMPT_HEADING, |
| 68 | 0, // Inline installs use the extension name. |
| 69 | 0, // Heading for bundle installs depends on the bundle contents. |
| 70 | IDS_EXTENSION_RE_ENABLE_PROMPT_HEADING, |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 71 | IDS_EXTENSION_PERMISSIONS_PROMPT_HEADING, |
[email protected] | 84660601 | 2012-10-19 18:42:25 | [diff] [blame] | 72 | 0, // External installs use different strings for extensions/apps. |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 73 | IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_HEADING, |
[email protected] | 1a93d8d | 2013-10-27 23:09:20 | [diff] [blame] | 74 | IDS_EXTENSION_LAUNCH_APP_PROMPT_HEADING, |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 75 | }; |
| 76 | static const int kButtons[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { |
| 77 | ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, |
| 78 | ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, |
| 79 | ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, |
| 80 | ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, |
| 81 | ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, |
| 82 | ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, |
| 83 | ui::DIALOG_BUTTON_CANCEL, |
[email protected] | aa5a547 | 2013-10-04 03:41:04 | [diff] [blame] | 84 | ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 85 | }; |
| 86 | static const int kAcceptButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { |
| 87 | IDS_EXTENSION_PROMPT_INSTALL_BUTTON, |
| 88 | IDS_EXTENSION_PROMPT_INSTALL_BUTTON, |
| 89 | IDS_EXTENSION_PROMPT_INSTALL_BUTTON, |
| 90 | IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON, |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 91 | IDS_EXTENSION_PROMPT_PERMISSIONS_BUTTON, |
[email protected] | 84660601 | 2012-10-19 18:42:25 | [diff] [blame] | 92 | 0, // External installs use different strings for extensions/apps. |
[email protected] | a2886e8b | 2013-06-08 05:15:02 | [diff] [blame] | 93 | IDS_EXTENSION_PROMPT_PERMISSIONS_CLEAR_RETAINED_FILES_BUTTON, |
[email protected] | 1a93d8d | 2013-10-27 23:09:20 | [diff] [blame] | 94 | IDS_EXTENSION_PROMPT_LAUNCH_BUTTON, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 95 | }; |
| 96 | static const int kAbortButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { |
| 97 | 0, // These all use the platform's default cancel label. |
| 98 | 0, |
| 99 | 0, |
| 100 | 0, |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 101 | IDS_EXTENSION_PROMPT_PERMISSIONS_ABORT_BUTTON, |
| 102 | IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_ABORT_BUTTON, |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 103 | IDS_CLOSE, |
[email protected] | bc123c0 | 2013-10-15 06:41:13 | [diff] [blame] | 104 | 0, // Platform dependent cancel button. |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 105 | }; |
| 106 | static const int kPermissionsHeaderIds[ |
| 107 | ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { |
| 108 | IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, |
| 109 | IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, |
| 110 | IDS_EXTENSION_PROMPT_THESE_WILL_HAVE_ACCESS_TO, |
| 111 | IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO, |
| 112 | IDS_EXTENSION_PROMPT_WANTS_ACCESS_TO, |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 113 | IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 114 | IDS_EXTENSION_PROMPT_CAN_ACCESS, |
[email protected] | 1a93d8d | 2013-10-27 23:09:20 | [diff] [blame] | 115 | IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 116 | }; |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 117 | static const int kOAuthHeaderIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { |
[email protected] | fc507794 | 2012-08-15 21:37:59 | [diff] [blame] | 118 | IDS_EXTENSION_PROMPT_OAUTH_HEADER, |
| 119 | 0, // Inline installs don't show OAuth permissions. |
| 120 | 0, // Bundle installs don't show OAuth permissions. |
| 121 | IDS_EXTENSION_PROMPT_OAUTH_REENABLE_HEADER, |
| 122 | IDS_EXTENSION_PROMPT_OAUTH_PERMISSIONS_HEADER, |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 123 | 0, |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 124 | 0, |
[email protected] | aa5a547 | 2013-10-04 03:41:04 | [diff] [blame] | 125 | IDS_EXTENSION_PROMPT_OAUTH_HEADER, |
[email protected] | fc507794 | 2012-08-15 21:37:59 | [diff] [blame] | 126 | }; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 127 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 128 | // Size of extension icon in top left of dialog. |
| 129 | const int kIconSize = 69; |
| 130 | |
[email protected] | dd46a4ce | 2012-09-15 10:50:50 | [diff] [blame] | 131 | // Returns pixel size under maximal scale factor for the icon whose device |
| 132 | // independent size is |size_in_dip| |
| 133 | int GetSizeForMaxScaleFactor(int size_in_dip) { |
[email protected] | 50b6626 | 2013-09-24 03:25:48 | [diff] [blame] | 134 | return static_cast<int>(size_in_dip * gfx::ImageSkia::GetMaxSupportedScale()); |
[email protected] | dd46a4ce | 2012-09-15 10:50:50 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | // Returns bitmap for the default icon with size equal to the default icon's |
| 138 | // pixel size under maximal supported scale factor. |
| 139 | SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) { |
[email protected] | 702d8b4 | 2013-02-27 20:55:50 | [diff] [blame] | 140 | const gfx::ImageSkia& image = is_app ? |
[email protected] | 7eb20e3 | 2014-04-30 08:50:56 | [diff] [blame^] | 141 | extensions::util::GetDefaultAppIcon() : |
| 142 | extensions::util::GetDefaultExtensionIcon(); |
[email protected] | 50b6626 | 2013-09-24 03:25:48 | [diff] [blame] | 143 | return image.GetRepresentation( |
| 144 | gfx::ImageSkia::GetMaxSupportedScale()).sk_bitmap(); |
[email protected] | dd46a4ce | 2012-09-15 10:50:50 | [diff] [blame] | 145 | } |
| 146 | |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 147 | // If auto confirm is enabled then posts a task to proceed with or cancel the |
| 148 | // install and returns true. Otherwise returns false. |
| 149 | bool AutoConfirmPrompt(ExtensionInstallPrompt::Delegate* delegate) { |
| 150 | const CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
| 151 | if (!cmdline->HasSwitch(switches::kAppsGalleryInstallAutoConfirmForTests)) |
| 152 | return false; |
| 153 | std::string value = cmdline->GetSwitchValueASCII( |
| 154 | switches::kAppsGalleryInstallAutoConfirmForTests); |
| 155 | |
| 156 | // We use PostTask instead of calling the delegate directly here, because in |
| 157 | // the real implementations it's highly likely the message loop will be |
| 158 | // pumping a few times before the user clicks accept or cancel. |
| 159 | if (value == "accept") { |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 160 | base::MessageLoop::current()->PostTask( |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 161 | FROM_HERE, |
| 162 | base::Bind(&ExtensionInstallPrompt::Delegate::InstallUIProceed, |
| 163 | base::Unretained(delegate))); |
| 164 | return true; |
| 165 | } |
| 166 | |
| 167 | if (value == "cancel") { |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 168 | base::MessageLoop::current()->PostTask( |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 169 | FROM_HERE, |
| 170 | base::Bind(&ExtensionInstallPrompt::Delegate::InstallUIAbort, |
| 171 | base::Unretained(delegate), |
| 172 | true)); |
| 173 | return true; |
| 174 | } |
| 175 | |
| 176 | NOTREACHED(); |
| 177 | return false; |
| 178 | } |
| 179 | |
[email protected] | 91e51d61 | 2012-10-21 23:03:05 | [diff] [blame] | 180 | Profile* ProfileForWebContents(content::WebContents* web_contents) { |
| 181 | if (!web_contents) |
| 182 | return NULL; |
| 183 | return Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 184 | } |
| 185 | |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 186 | gfx::NativeWindow NativeWindowForWebContents(content::WebContents* contents) { |
| 187 | if (!contents) |
| 188 | return NULL; |
| 189 | |
| 190 | return contents->GetView()->GetTopLevelNativeWindow(); |
| 191 | } |
| 192 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 193 | } // namespace |
| 194 | |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 195 | ExtensionInstallPrompt::Prompt::Prompt(PromptType type) |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 196 | : type_(type), |
[email protected] | 79a6f99a | 2013-08-29 00:32:58 | [diff] [blame] | 197 | is_showing_details_for_retained_files_(false), |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 198 | extension_(NULL), |
| 199 | bundle_(NULL), |
| 200 | average_rating_(0.0), |
[email protected] | dcde34b3 | 2013-07-31 02:28:45 | [diff] [blame] | 201 | rating_count_(0), |
[email protected] | 34b5f7f | 2014-01-29 02:48:11 | [diff] [blame] | 202 | show_user_count_(false), |
| 203 | has_webstore_data_(false) { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | ExtensionInstallPrompt::Prompt::~Prompt() { |
| 207 | } |
| 208 | |
| 209 | void ExtensionInstallPrompt::Prompt::SetPermissions( |
[email protected] | d2065e06 | 2013-12-12 23:49:52 | [diff] [blame] | 210 | const std::vector<base::string16>& permissions) { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 211 | permissions_ = permissions; |
| 212 | } |
| 213 | |
[email protected] | 8ab7e6c | 2013-07-11 21:15:03 | [diff] [blame] | 214 | void ExtensionInstallPrompt::Prompt::SetPermissionsDetails( |
[email protected] | d2065e06 | 2013-12-12 23:49:52 | [diff] [blame] | 215 | const std::vector<base::string16>& details) { |
[email protected] | 8ab7e6c | 2013-07-11 21:15:03 | [diff] [blame] | 216 | details_ = details; |
[email protected] | 79a6f99a | 2013-08-29 00:32:58 | [diff] [blame] | 217 | is_showing_details_for_permissions_.clear(); |
| 218 | for (size_t i = 0; i < details.size(); ++i) |
| 219 | is_showing_details_for_permissions_.push_back(false); |
| 220 | } |
| 221 | |
| 222 | void ExtensionInstallPrompt::Prompt::SetIsShowingDetails( |
| 223 | DetailsType type, |
| 224 | size_t index, |
| 225 | bool is_showing_details) { |
| 226 | switch (type) { |
| 227 | case PERMISSIONS_DETAILS: |
| 228 | is_showing_details_for_permissions_[index] = is_showing_details; |
| 229 | break; |
| 230 | case OAUTH_DETAILS: |
| 231 | is_showing_details_for_oauth_[index] = is_showing_details; |
| 232 | break; |
| 233 | case RETAINED_FILES_DETAILS: |
| 234 | is_showing_details_for_retained_files_ = is_showing_details; |
| 235 | break; |
| 236 | } |
[email protected] | 8ab7e6c | 2013-07-11 21:15:03 | [diff] [blame] | 237 | } |
| 238 | |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 239 | void ExtensionInstallPrompt::Prompt::SetOAuthIssueAdvice( |
| 240 | const IssueAdviceInfo& issue_advice) { |
[email protected] | 79a6f99a | 2013-08-29 00:32:58 | [diff] [blame] | 241 | is_showing_details_for_oauth_.clear(); |
| 242 | for (size_t i = 0; i < issue_advice.size(); ++i) |
| 243 | is_showing_details_for_oauth_.push_back(false); |
| 244 | |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 245 | oauth_issue_advice_ = issue_advice; |
| 246 | } |
| 247 | |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 248 | void ExtensionInstallPrompt::Prompt::SetUserNameFromProfile(Profile* profile) { |
| 249 | // |profile| can be NULL in unit tests. |
| 250 | if (profile) { |
[email protected] | 0433872 | 2013-12-24 23:18:05 | [diff] [blame] | 251 | oauth_user_name_ = base::UTF8ToUTF16(profile->GetPrefs()->GetString( |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 252 | prefs::kGoogleServicesUsername)); |
| 253 | } else { |
| 254 | oauth_user_name_.clear(); |
| 255 | } |
| 256 | } |
| 257 | |
[email protected] | 34b5f7f | 2014-01-29 02:48:11 | [diff] [blame] | 258 | void ExtensionInstallPrompt::Prompt::SetWebstoreData( |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 259 | const std::string& localized_user_count, |
[email protected] | dcde34b3 | 2013-07-31 02:28:45 | [diff] [blame] | 260 | bool show_user_count, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 261 | double average_rating, |
| 262 | int rating_count) { |
[email protected] | 34b5f7f | 2014-01-29 02:48:11 | [diff] [blame] | 263 | CHECK(type_ == INLINE_INSTALL_PROMPT || type_ == EXTERNAL_INSTALL_PROMPT); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 264 | localized_user_count_ = localized_user_count; |
[email protected] | dcde34b3 | 2013-07-31 02:28:45 | [diff] [blame] | 265 | show_user_count_ = show_user_count; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 266 | average_rating_ = average_rating; |
| 267 | rating_count_ = rating_count; |
[email protected] | 34b5f7f | 2014-01-29 02:48:11 | [diff] [blame] | 268 | has_webstore_data_ = true; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 269 | } |
| 270 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 271 | base::string16 ExtensionInstallPrompt::Prompt::GetDialogTitle() const { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 272 | int resource_id = kTitleIds[type_]; |
| 273 | |
| 274 | if (type_ == INSTALL_PROMPT) { |
| 275 | if (extension_->is_app()) |
| 276 | resource_id = IDS_EXTENSION_INSTALL_APP_PROMPT_TITLE; |
| 277 | else if (extension_->is_theme()) |
| 278 | resource_id = IDS_EXTENSION_INSTALL_THEME_PROMPT_TITLE; |
| 279 | else |
| 280 | resource_id = IDS_EXTENSION_INSTALL_EXTENSION_PROMPT_TITLE; |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 281 | } else if (type_ == EXTERNAL_INSTALL_PROMPT) { |
| 282 | return l10n_util::GetStringFUTF16( |
[email protected] | 0433872 | 2013-12-24 23:18:05 | [diff] [blame] | 283 | resource_id, base::UTF8ToUTF16(extension_->name())); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | return l10n_util::GetStringUTF16(resource_id); |
| 287 | } |
| 288 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 289 | base::string16 ExtensionInstallPrompt::Prompt::GetHeading() const { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 290 | if (type_ == INLINE_INSTALL_PROMPT) { |
[email protected] | 0433872 | 2013-12-24 23:18:05 | [diff] [blame] | 291 | return base::UTF8ToUTF16(extension_->name()); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 292 | } else if (type_ == BUNDLE_INSTALL_PROMPT) { |
| 293 | return bundle_->GetHeadingTextFor(BundleInstaller::Item::STATE_PENDING); |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 294 | } else if (type_ == EXTERNAL_INSTALL_PROMPT) { |
[email protected] | 84660601 | 2012-10-19 18:42:25 | [diff] [blame] | 295 | int resource_id = -1; |
| 296 | if (extension_->is_app()) |
| 297 | resource_id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_HEADING_APP; |
| 298 | else if (extension_->is_theme()) |
| 299 | resource_id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_HEADING_THEME; |
| 300 | else |
| 301 | resource_id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_HEADING_EXTENSION; |
| 302 | return l10n_util::GetStringUTF16(resource_id); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 303 | } else { |
| 304 | return l10n_util::GetStringFUTF16( |
[email protected] | 0433872 | 2013-12-24 23:18:05 | [diff] [blame] | 305 | kHeadingIds[type_], base::UTF8ToUTF16(extension_->name())); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 306 | } |
| 307 | } |
| 308 | |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 309 | int ExtensionInstallPrompt::Prompt::GetDialogButtons() const { |
[email protected] | a2886e8b | 2013-06-08 05:15:02 | [diff] [blame] | 310 | if (type_ == POST_INSTALL_PERMISSIONS_PROMPT && |
| 311 | ShouldDisplayRevokeFilesButton()) { |
| 312 | return kButtons[type_] | ui::DIALOG_BUTTON_OK; |
| 313 | } |
| 314 | |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 315 | return kButtons[type_]; |
| 316 | } |
| 317 | |
[email protected] | 62a28d7c | 2013-12-28 01:34:49 | [diff] [blame] | 318 | bool ExtensionInstallPrompt::Prompt::ShouldShowExplanationText() const { |
| 319 | return type_ == INSTALL_PROMPT && |
| 320 | extension_->is_extension() && experiment_ && experiment_->text_only(); |
| 321 | } |
| 322 | |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 323 | bool ExtensionInstallPrompt::Prompt::HasAcceptButtonLabel() const { |
[email protected] | a2886e8b | 2013-06-08 05:15:02 | [diff] [blame] | 324 | if (kAcceptButtonIds[type_] == 0) |
| 325 | return false; |
| 326 | |
| 327 | if (type_ == POST_INSTALL_PERMISSIONS_PROMPT) |
| 328 | return ShouldDisplayRevokeFilesButton(); |
| 329 | |
| 330 | return true; |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 331 | } |
| 332 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 333 | base::string16 ExtensionInstallPrompt::Prompt::GetAcceptButtonLabel() const { |
[email protected] | 84660601 | 2012-10-19 18:42:25 | [diff] [blame] | 334 | if (type_ == EXTERNAL_INSTALL_PROMPT) { |
| 335 | int id = -1; |
| 336 | if (extension_->is_app()) |
| 337 | id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_ACCEPT_BUTTON_APP; |
| 338 | else if (extension_->is_theme()) |
| 339 | id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_ACCEPT_BUTTON_THEME; |
| 340 | else |
| 341 | id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_ACCEPT_BUTTON_EXTENSION; |
| 342 | return l10n_util::GetStringUTF16(id); |
| 343 | } |
[email protected] | 62a28d7c | 2013-12-28 01:34:49 | [diff] [blame] | 344 | if (ShouldShowExplanationText()) |
| 345 | return experiment_->GetOkButtonText(); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 346 | return l10n_util::GetStringUTF16(kAcceptButtonIds[type_]); |
| 347 | } |
| 348 | |
| 349 | bool ExtensionInstallPrompt::Prompt::HasAbortButtonLabel() const { |
[email protected] | 62a28d7c | 2013-12-28 01:34:49 | [diff] [blame] | 350 | if (ShouldShowExplanationText()) |
| 351 | return true; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 352 | return kAbortButtonIds[type_] > 0; |
| 353 | } |
| 354 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 355 | base::string16 ExtensionInstallPrompt::Prompt::GetAbortButtonLabel() const { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 356 | CHECK(HasAbortButtonLabel()); |
[email protected] | 62a28d7c | 2013-12-28 01:34:49 | [diff] [blame] | 357 | if (ShouldShowExplanationText()) |
| 358 | return experiment_->GetCancelButtonText(); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 359 | return l10n_util::GetStringUTF16(kAbortButtonIds[type_]); |
| 360 | } |
| 361 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 362 | base::string16 ExtensionInstallPrompt::Prompt::GetPermissionsHeading() const { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 363 | return l10n_util::GetStringUTF16(kPermissionsHeaderIds[type_]); |
| 364 | } |
| 365 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 366 | base::string16 ExtensionInstallPrompt::Prompt::GetOAuthHeading() const { |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 367 | return l10n_util::GetStringFUTF16(kOAuthHeaderIds[type_], oauth_user_name_); |
[email protected] | 813475e | 2012-07-02 23:54:18 | [diff] [blame] | 368 | } |
| 369 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 370 | base::string16 ExtensionInstallPrompt::Prompt::GetRetainedFilesHeading() const { |
[email protected] | 4f1e108 | 2013-09-23 10:30:53 | [diff] [blame] | 371 | const int kRetainedFilesMessageIDs[6] = { |
| 372 | IDS_EXTENSION_PROMPT_RETAINED_FILES_DEFAULT, |
| 373 | IDS_EXTENSION_PROMPT_RETAINED_FILE_SINGULAR, |
| 374 | IDS_EXTENSION_PROMPT_RETAINED_FILES_ZERO, |
| 375 | IDS_EXTENSION_PROMPT_RETAINED_FILES_TWO, |
| 376 | IDS_EXTENSION_PROMPT_RETAINED_FILES_FEW, |
| 377 | IDS_EXTENSION_PROMPT_RETAINED_FILES_MANY, |
| 378 | }; |
| 379 | std::vector<int> message_ids; |
| 380 | for (size_t i = 0; i < arraysize(kRetainedFilesMessageIDs); i++) { |
| 381 | message_ids.push_back(kRetainedFilesMessageIDs[i]); |
| 382 | } |
| 383 | return l10n_util::GetPluralStringFUTF16(message_ids, GetRetainedFileCount()); |
[email protected] | 8ab7e6c | 2013-07-11 21:15:03 | [diff] [blame] | 384 | } |
| 385 | |
[email protected] | f2cd899 | 2013-06-11 17:30:18 | [diff] [blame] | 386 | bool ExtensionInstallPrompt::Prompt::ShouldShowPermissions() const { |
| 387 | return GetPermissionCount() > 0 || type_ == POST_INSTALL_PERMISSIONS_PROMPT; |
| 388 | } |
| 389 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 390 | void ExtensionInstallPrompt::Prompt::AppendRatingStars( |
| 391 | StarAppender appender, void* data) const { |
| 392 | CHECK(appender); |
[email protected] | 34b5f7f | 2014-01-29 02:48:11 | [diff] [blame] | 393 | CHECK(type_ == INLINE_INSTALL_PROMPT || type_ == EXTERNAL_INSTALL_PROMPT); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 394 | int rating_integer = floor(average_rating_); |
| 395 | double rating_fractional = average_rating_ - rating_integer; |
| 396 | |
| 397 | if (rating_fractional > 0.66) { |
| 398 | rating_integer++; |
| 399 | } |
| 400 | |
| 401 | if (rating_fractional < 0.33 || rating_fractional > 0.66) { |
| 402 | rating_fractional = 0; |
| 403 | } |
| 404 | |
| 405 | ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 406 | int i; |
| 407 | for (i = 0; i < rating_integer; i++) { |
| 408 | appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_ON), data); |
| 409 | } |
| 410 | if (rating_fractional) { |
| 411 | appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_HALF_LEFT), data); |
| 412 | i++; |
| 413 | } |
| 414 | for (; i < kMaxExtensionRating; i++) { |
| 415 | appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_OFF), data); |
| 416 | } |
| 417 | } |
| 418 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 419 | base::string16 ExtensionInstallPrompt::Prompt::GetRatingCount() const { |
[email protected] | 34b5f7f | 2014-01-29 02:48:11 | [diff] [blame] | 420 | CHECK(type_ == INLINE_INSTALL_PROMPT || type_ == EXTERNAL_INSTALL_PROMPT); |
[email protected] | 6725048e | 2013-10-24 21:47:14 | [diff] [blame] | 421 | return l10n_util::GetStringFUTF16(IDS_EXTENSION_RATING_COUNT, |
| 422 | base::IntToString16(rating_count_)); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 423 | } |
| 424 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 425 | base::string16 ExtensionInstallPrompt::Prompt::GetUserCount() const { |
[email protected] | 34b5f7f | 2014-01-29 02:48:11 | [diff] [blame] | 426 | CHECK(type_ == INLINE_INSTALL_PROMPT || type_ == EXTERNAL_INSTALL_PROMPT); |
[email protected] | dcde34b3 | 2013-07-31 02:28:45 | [diff] [blame] | 427 | |
| 428 | if (show_user_count_) { |
[email protected] | 6725048e | 2013-10-24 21:47:14 | [diff] [blame] | 429 | return l10n_util::GetStringFUTF16(IDS_EXTENSION_USER_COUNT, |
| 430 | base::UTF8ToUTF16(localized_user_count_)); |
[email protected] | dcde34b3 | 2013-07-31 02:28:45 | [diff] [blame] | 431 | } |
[email protected] | 6725048e | 2013-10-24 21:47:14 | [diff] [blame] | 432 | return base::string16(); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 433 | } |
| 434 | |
| 435 | size_t ExtensionInstallPrompt::Prompt::GetPermissionCount() const { |
| 436 | return permissions_.size(); |
| 437 | } |
| 438 | |
[email protected] | 8ab7e6c | 2013-07-11 21:15:03 | [diff] [blame] | 439 | size_t ExtensionInstallPrompt::Prompt::GetPermissionsDetailsCount() const { |
| 440 | return details_.size(); |
| 441 | } |
| 442 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 443 | base::string16 ExtensionInstallPrompt::Prompt::GetPermission(size_t index) |
| 444 | const { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 445 | CHECK_LT(index, permissions_.size()); |
[email protected] | ef2654e4 | 2012-08-11 03:57:56 | [diff] [blame] | 446 | return permissions_[index]; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 447 | } |
| 448 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 449 | base::string16 ExtensionInstallPrompt::Prompt::GetPermissionsDetails( |
[email protected] | 8ab7e6c | 2013-07-11 21:15:03 | [diff] [blame] | 450 | size_t index) const { |
| 451 | CHECK_LT(index, details_.size()); |
| 452 | return details_[index]; |
| 453 | } |
| 454 | |
[email protected] | 79a6f99a | 2013-08-29 00:32:58 | [diff] [blame] | 455 | bool ExtensionInstallPrompt::Prompt::GetIsShowingDetails( |
| 456 | DetailsType type, size_t index) const { |
| 457 | switch (type) { |
| 458 | case PERMISSIONS_DETAILS: |
| 459 | CHECK_LT(index, is_showing_details_for_permissions_.size()); |
| 460 | return is_showing_details_for_permissions_[index]; |
| 461 | case OAUTH_DETAILS: |
| 462 | CHECK_LT(index, is_showing_details_for_oauth_.size()); |
| 463 | return is_showing_details_for_oauth_[index]; |
| 464 | case RETAINED_FILES_DETAILS: |
| 465 | return is_showing_details_for_retained_files_; |
| 466 | } |
| 467 | return false; |
| 468 | } |
| 469 | |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 470 | size_t ExtensionInstallPrompt::Prompt::GetOAuthIssueCount() const { |
| 471 | return oauth_issue_advice_.size(); |
| 472 | } |
| 473 | |
| 474 | const IssueAdviceInfoEntry& ExtensionInstallPrompt::Prompt::GetOAuthIssue( |
| 475 | size_t index) const { |
| 476 | CHECK_LT(index, oauth_issue_advice_.size()); |
| 477 | return oauth_issue_advice_[index]; |
| 478 | } |
| 479 | |
[email protected] | a2886e8b | 2013-06-08 05:15:02 | [diff] [blame] | 480 | size_t ExtensionInstallPrompt::Prompt::GetRetainedFileCount() const { |
| 481 | return retained_files_.size(); |
| 482 | } |
| 483 | |
[email protected] | 6a72a63 | 2013-12-12 22:22:00 | [diff] [blame] | 484 | base::string16 ExtensionInstallPrompt::Prompt::GetRetainedFile(size_t index) |
| 485 | const { |
[email protected] | a2886e8b | 2013-06-08 05:15:02 | [diff] [blame] | 486 | CHECK_LT(index, retained_files_.size()); |
[email protected] | 6725048e | 2013-10-24 21:47:14 | [diff] [blame] | 487 | return retained_files_[index].AsUTF16Unsafe(); |
[email protected] | a2886e8b | 2013-06-08 05:15:02 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | bool ExtensionInstallPrompt::Prompt::ShouldDisplayRevokeFilesButton() const { |
| 491 | return !retained_files_.empty(); |
| 492 | } |
| 493 | |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 494 | ExtensionInstallPrompt::ShowParams::ShowParams(content::WebContents* contents) |
| 495 | : parent_web_contents(contents), |
| 496 | parent_window(NativeWindowForWebContents(contents)), |
| 497 | navigator(contents) { |
| 498 | } |
| 499 | |
| 500 | ExtensionInstallPrompt::ShowParams::ShowParams( |
| 501 | gfx::NativeWindow window, |
| 502 | content::PageNavigator* navigator) |
| 503 | : parent_web_contents(NULL), |
| 504 | parent_window(window), |
| 505 | navigator(navigator) { |
| 506 | } |
| 507 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 508 | // static |
| 509 | scoped_refptr<Extension> |
| 510 | ExtensionInstallPrompt::GetLocalizedExtensionForDisplay( |
[email protected] | 023b3d1 | 2013-12-23 18:46:49 | [diff] [blame] | 511 | const base::DictionaryValue* manifest, |
[email protected] | c422a86 | 2012-07-31 15:46:13 | [diff] [blame] | 512 | int flags, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 513 | const std::string& id, |
| 514 | const std::string& localized_name, |
| 515 | const std::string& localized_description, |
| 516 | std::string* error) { |
[email protected] | 023b3d1 | 2013-12-23 18:46:49 | [diff] [blame] | 517 | scoped_ptr<base::DictionaryValue> localized_manifest; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 518 | if (!localized_name.empty() || !localized_description.empty()) { |
| 519 | localized_manifest.reset(manifest->DeepCopy()); |
| 520 | if (!localized_name.empty()) { |
[email protected] | 6bf9061 | 2013-08-15 00:36:27 | [diff] [blame] | 521 | localized_manifest->SetString(extensions::manifest_keys::kName, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 522 | localized_name); |
| 523 | } |
| 524 | if (!localized_description.empty()) { |
[email protected] | 6bf9061 | 2013-08-15 00:36:27 | [diff] [blame] | 525 | localized_manifest->SetString(extensions::manifest_keys::kDescription, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 526 | localized_description); |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | return Extension::Create( |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 531 | base::FilePath(), |
[email protected] | 1d5e58b | 2013-01-31 08:41:40 | [diff] [blame] | 532 | Manifest::INTERNAL, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 533 | localized_manifest.get() ? *localized_manifest.get() : *manifest, |
[email protected] | c422a86 | 2012-07-31 15:46:13 | [diff] [blame] | 534 | flags, |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 535 | id, |
| 536 | error); |
| 537 | } |
| 538 | |
[email protected] | 7f16534 | 2014-02-12 09:22:22 | [diff] [blame] | 539 | ExtensionInstallPrompt::ExtensionInstallPrompt(content::WebContents* contents) |
[email protected] | f1e9848 | 2013-12-27 00:45:59 | [diff] [blame] | 540 | : OAuth2TokenService::Consumer("extensions_install"), |
| 541 | record_oauth2_grant_(false), |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 542 | ui_loop_(base::MessageLoop::current()), |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 543 | extension_(NULL), |
[email protected] | 7f16534 | 2014-02-12 09:22:22 | [diff] [blame] | 544 | bundle_(NULL), |
[email protected] | 91e51d61 | 2012-10-21 23:03:05 | [diff] [blame] | 545 | install_ui_(ExtensionInstallUI::Create(ProfileForWebContents(contents))), |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 546 | show_params_(contents), |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 547 | delegate_(NULL), |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 548 | prompt_(UNSET_PROMPT_TYPE) { |
| 549 | prompt_.SetUserNameFromProfile(install_ui_->profile()); |
| 550 | } |
| 551 | |
| 552 | ExtensionInstallPrompt::ExtensionInstallPrompt( |
| 553 | Profile* profile, |
| 554 | gfx::NativeWindow native_window, |
| 555 | content::PageNavigator* navigator) |
[email protected] | f1e9848 | 2013-12-27 00:45:59 | [diff] [blame] | 556 | : OAuth2TokenService::Consumer("extensions_install"), |
| 557 | record_oauth2_grant_(false), |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 558 | ui_loop_(base::MessageLoop::current()), |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 559 | extension_(NULL), |
[email protected] | 7f16534 | 2014-02-12 09:22:22 | [diff] [blame] | 560 | bundle_(NULL), |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 561 | install_ui_(ExtensionInstallUI::Create(profile)), |
| 562 | show_params_(native_window, navigator), |
| 563 | delegate_(NULL), |
| 564 | prompt_(UNSET_PROMPT_TYPE) { |
| 565 | prompt_.SetUserNameFromProfile(install_ui_->profile()); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 566 | } |
| 567 | |
| 568 | ExtensionInstallPrompt::~ExtensionInstallPrompt() { |
| 569 | } |
| 570 | |
| 571 | void ExtensionInstallPrompt::ConfirmBundleInstall( |
| 572 | extensions::BundleInstaller* bundle, |
[email protected] | c2e66e1 | 2012-06-27 06:27:06 | [diff] [blame] | 573 | const PermissionSet* permissions) { |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 574 | DCHECK(ui_loop_ == base::MessageLoop::current()); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 575 | bundle_ = bundle; |
| 576 | permissions_ = permissions; |
| 577 | delegate_ = bundle; |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 578 | prompt_.set_type(BUNDLE_INSTALL_PROMPT); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 579 | |
[email protected] | 4e49487 | 2013-09-06 09:13:54 | [diff] [blame] | 580 | ShowConfirmation(); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 581 | } |
| 582 | |
[email protected] | 734bcec | 2012-10-08 20:29:05 | [diff] [blame] | 583 | void ExtensionInstallPrompt::ConfirmStandaloneInstall( |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 584 | Delegate* delegate, |
| 585 | const Extension* extension, |
| 586 | SkBitmap* icon, |
| 587 | const ExtensionInstallPrompt::Prompt& prompt) { |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 588 | DCHECK(ui_loop_ == base::MessageLoop::current()); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 589 | extension_ = extension; |
| 590 | permissions_ = extension->GetActivePermissions(); |
| 591 | delegate_ = delegate; |
| 592 | prompt_ = prompt; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 593 | |
| 594 | SetIcon(icon); |
[email protected] | 4e49487 | 2013-09-06 09:13:54 | [diff] [blame] | 595 | ShowConfirmation(); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 596 | } |
| 597 | |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 598 | void ExtensionInstallPrompt::ConfirmWebstoreInstall( |
| 599 | Delegate* delegate, |
| 600 | const Extension* extension, |
| 601 | const SkBitmap* icon, |
| 602 | const ShowDialogCallback& show_dialog_callback) { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 603 | // SetIcon requires |extension_| to be set. ConfirmInstall will setup the |
| 604 | // remaining fields. |
| 605 | extension_ = extension; |
| 606 | SetIcon(icon); |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 607 | ConfirmInstall(delegate, extension, show_dialog_callback); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 608 | } |
| 609 | |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 610 | void ExtensionInstallPrompt::ConfirmInstall( |
| 611 | Delegate* delegate, |
| 612 | const Extension* extension, |
| 613 | const ShowDialogCallback& show_dialog_callback) { |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 614 | DCHECK(ui_loop_ == base::MessageLoop::current()); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 615 | extension_ = extension; |
| 616 | permissions_ = extension->GetActivePermissions(); |
| 617 | delegate_ = delegate; |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 618 | prompt_.set_type(INSTALL_PROMPT); |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 619 | show_dialog_callback_ = show_dialog_callback; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 620 | |
| 621 | // We special-case themes to not show any confirm UI. Instead they are |
| 622 | // immediately installed, and then we show an infobar (see OnInstallSuccess) |
| 623 | // to allow the user to revert if they don't like it. |
| 624 | // |
| 625 | // We don't do this in the case where off-store extension installs are |
| 626 | // disabled because in that case, we don't show the dangerous download UI, so |
| 627 | // we need the UI confirmation. |
| 628 | if (extension->is_theme()) { |
| 629 | if (extension->from_webstore() || |
[email protected] | 544471a | 2012-10-13 05:27:09 | [diff] [blame] | 630 | extensions::FeatureSwitch::easy_off_store_install()->IsEnabled()) { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 631 | delegate->InstallUIProceed(); |
| 632 | return; |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | LoadImageIfNeeded(); |
| 637 | } |
| 638 | |
| 639 | void ExtensionInstallPrompt::ConfirmReEnable(Delegate* delegate, |
| 640 | const Extension* extension) { |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 641 | DCHECK(ui_loop_ == base::MessageLoop::current()); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 642 | extension_ = extension; |
| 643 | permissions_ = extension->GetActivePermissions(); |
| 644 | delegate_ = delegate; |
[email protected] | ab6c7be4 | 2014-01-16 02:05:54 | [diff] [blame] | 645 | prompt_.set_type(extension->is_ephemeral() ? LAUNCH_PROMPT : |
| 646 | RE_ENABLE_PROMPT); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 647 | |
| 648 | LoadImageIfNeeded(); |
| 649 | } |
| 650 | |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 651 | void ExtensionInstallPrompt::ConfirmExternalInstall( |
[email protected] | c8ff7c9e | 2013-04-20 12:36:27 | [diff] [blame] | 652 | Delegate* delegate, |
| 653 | const Extension* extension, |
[email protected] | 34b5f7f | 2014-01-29 02:48:11 | [diff] [blame] | 654 | const ShowDialogCallback& show_dialog_callback, |
| 655 | const Prompt& prompt) { |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 656 | DCHECK(ui_loop_ == base::MessageLoop::current()); |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 657 | extension_ = extension; |
| 658 | permissions_ = extension->GetActivePermissions(); |
| 659 | delegate_ = delegate; |
[email protected] | 34b5f7f | 2014-01-29 02:48:11 | [diff] [blame] | 660 | prompt_ = prompt; |
[email protected] | c8ff7c9e | 2013-04-20 12:36:27 | [diff] [blame] | 661 | show_dialog_callback_ = show_dialog_callback; |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 662 | |
| 663 | LoadImageIfNeeded(); |
| 664 | } |
| 665 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 666 | void ExtensionInstallPrompt::ConfirmPermissions( |
| 667 | Delegate* delegate, |
| 668 | const Extension* extension, |
[email protected] | c2e66e1 | 2012-06-27 06:27:06 | [diff] [blame] | 669 | const PermissionSet* permissions) { |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 670 | DCHECK(ui_loop_ == base::MessageLoop::current()); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 671 | extension_ = extension; |
| 672 | permissions_ = permissions; |
| 673 | delegate_ = delegate; |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 674 | prompt_.set_type(PERMISSIONS_PROMPT); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 675 | |
| 676 | LoadImageIfNeeded(); |
| 677 | } |
| 678 | |
[email protected] | f746b3f | 2012-07-03 17:53:37 | [diff] [blame] | 679 | void ExtensionInstallPrompt::ConfirmIssueAdvice( |
| 680 | Delegate* delegate, |
| 681 | const Extension* extension, |
| 682 | const IssueAdviceInfo& issue_advice) { |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 683 | DCHECK(ui_loop_ == base::MessageLoop::current()); |
[email protected] | f746b3f | 2012-07-03 17:53:37 | [diff] [blame] | 684 | extension_ = extension; |
| 685 | delegate_ = delegate; |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 686 | prompt_.set_type(PERMISSIONS_PROMPT); |
[email protected] | f746b3f | 2012-07-03 17:53:37 | [diff] [blame] | 687 | |
| 688 | record_oauth2_grant_ = true; |
| 689 | prompt_.SetOAuthIssueAdvice(issue_advice); |
| 690 | |
| 691 | LoadImageIfNeeded(); |
| 692 | } |
| 693 | |
[email protected] | a2886e8b | 2013-06-08 05:15:02 | [diff] [blame] | 694 | void ExtensionInstallPrompt::ReviewPermissions( |
| 695 | Delegate* delegate, |
| 696 | const Extension* extension, |
| 697 | const std::vector<base::FilePath>& retained_file_paths) { |
[email protected] | b3a2509 | 2013-05-28 22:08:16 | [diff] [blame] | 698 | DCHECK(ui_loop_ == base::MessageLoop::current()); |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 699 | extension_ = extension; |
| 700 | permissions_ = extension->GetActivePermissions(); |
[email protected] | a2886e8b | 2013-06-08 05:15:02 | [diff] [blame] | 701 | prompt_.set_retained_files(retained_file_paths); |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 702 | delegate_ = delegate; |
| 703 | prompt_.set_type(POST_INSTALL_PERMISSIONS_PROMPT); |
| 704 | |
| 705 | LoadImageIfNeeded(); |
| 706 | } |
| 707 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 708 | void ExtensionInstallPrompt::OnInstallSuccess(const Extension* extension, |
| 709 | SkBitmap* icon) { |
| 710 | extension_ = extension; |
| 711 | SetIcon(icon); |
| 712 | |
| 713 | install_ui_->OnInstallSuccess(extension, &icon_); |
| 714 | } |
| 715 | |
[email protected] | bf3d9df | 2012-07-24 23:20:27 | [diff] [blame] | 716 | void ExtensionInstallPrompt::OnInstallFailure( |
| 717 | const extensions::CrxInstallerError& error) { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 718 | install_ui_->OnInstallFailure(error); |
| 719 | } |
| 720 | |
| 721 | void ExtensionInstallPrompt::SetIcon(const SkBitmap* image) { |
| 722 | if (image) |
| 723 | icon_ = *image; |
| 724 | else |
| 725 | icon_ = SkBitmap(); |
[email protected] | dd46a4ce | 2012-09-15 10:50:50 | [diff] [blame] | 726 | if (icon_.empty()) { |
| 727 | // Let's set default icon bitmap whose size is equal to the default icon's |
| 728 | // pixel size under maximal supported scale factor. If the bitmap is larger |
| 729 | // than the one we need, it will be scaled down by the ui code. |
| 730 | icon_ = GetDefaultIconBitmapForMaxScaleFactor(extension_->is_app()); |
| 731 | } |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 732 | } |
| 733 | |
[email protected] | ec7de0c5a | 2012-11-16 07:40:47 | [diff] [blame] | 734 | void ExtensionInstallPrompt::OnImageLoaded(const gfx::Image& image) { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 735 | SetIcon(image.IsEmpty() ? NULL : image.ToSkBitmap()); |
[email protected] | 4e49487 | 2013-09-06 09:13:54 | [diff] [blame] | 736 | ShowConfirmation(); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | void ExtensionInstallPrompt::LoadImageIfNeeded() { |
| 740 | // Bundle install prompts do not have an icon. |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 741 | // Also |install_ui_.profile()| can be NULL in unit tests. |
| 742 | if (!icon_.empty() || !install_ui_->profile()) { |
[email protected] | 4e49487 | 2013-09-06 09:13:54 | [diff] [blame] | 743 | ShowConfirmation(); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 744 | return; |
| 745 | } |
| 746 | |
| 747 | // Load the image asynchronously. For the response, check OnImageLoaded. |
[email protected] | 993da5e | 2013-03-23 21:25:16 | [diff] [blame] | 748 | extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource( |
[email protected] | 702d8b4 | 2013-02-27 20:55:50 | [diff] [blame] | 749 | extension_, |
| 750 | extension_misc::EXTENSION_ICON_LARGE, |
| 751 | ExtensionIconSet::MATCH_BIGGER); |
[email protected] | dd46a4ce | 2012-09-15 10:50:50 | [diff] [blame] | 752 | // Load the icon whose pixel size is large enough to be displayed under |
| 753 | // maximal supported scale factor. UI code will scale the icon down if needed. |
| 754 | // TODO(tbarzic): We should use IconImage here and load the required bitmap |
| 755 | // lazily. |
| 756 | int pixel_size = GetSizeForMaxScaleFactor(kIconSize); |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 757 | extensions::ImageLoader::Get(install_ui_->profile())->LoadImageAsync( |
[email protected] | ec7de0c5a | 2012-11-16 07:40:47 | [diff] [blame] | 758 | extension_, image, gfx::Size(pixel_size, pixel_size), |
| 759 | base::Bind(&ExtensionInstallPrompt::OnImageLoaded, AsWeakPtr())); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 760 | } |
| 761 | |
[email protected] | 4f3fb35 | 2013-07-17 04:07:01 | [diff] [blame] | 762 | void ExtensionInstallPrompt::OnGetTokenSuccess( |
| 763 | const OAuth2TokenService::Request* request, |
| 764 | const std::string& access_token, |
| 765 | const base::Time& expiration_time) { |
| 766 | DCHECK_EQ(login_token_request_.get(), request); |
| 767 | login_token_request_.reset(); |
| 768 | |
| 769 | const extensions::OAuth2Info& oauth2_info = |
| 770 | extensions::OAuth2Info::GetOAuth2Info(extension_); |
| 771 | |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 772 | token_flow_.reset(new OAuth2MintTokenFlow( |
[email protected] | 4f3fb35 | 2013-07-17 04:07:01 | [diff] [blame] | 773 | install_ui_->profile()->GetRequestContext(), |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 774 | this, |
| 775 | OAuth2MintTokenFlow::Parameters( |
[email protected] | 4f3fb35 | 2013-07-17 04:07:01 | [diff] [blame] | 776 | access_token, |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 777 | extension_->id(), |
| 778 | oauth2_info.client_id, |
[email protected] | d4a37f1c | 2012-07-09 21:36:13 | [diff] [blame] | 779 | oauth2_info.scopes, |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 780 | OAuth2MintTokenFlow::MODE_ISSUE_ADVICE))); |
| 781 | token_flow_->Start(); |
| 782 | } |
| 783 | |
[email protected] | 4f3fb35 | 2013-07-17 04:07:01 | [diff] [blame] | 784 | void ExtensionInstallPrompt::OnGetTokenFailure( |
| 785 | const OAuth2TokenService::Request* request, |
| 786 | const GoogleServiceAuthError& error) { |
| 787 | DCHECK_EQ(login_token_request_.get(), request); |
| 788 | login_token_request_.reset(); |
| 789 | ShowConfirmation(); |
| 790 | } |
| 791 | |
[email protected] | b70a2d9 | 2012-06-28 19:51:21 | [diff] [blame] | 792 | void ExtensionInstallPrompt::OnIssueAdviceSuccess( |
| 793 | const IssueAdviceInfo& advice_info) { |
| 794 | prompt_.SetOAuthIssueAdvice(advice_info); |
| 795 | record_oauth2_grant_ = true; |
| 796 | ShowConfirmation(); |
| 797 | } |
| 798 | |
| 799 | void ExtensionInstallPrompt::OnMintTokenFailure( |
| 800 | const GoogleServiceAuthError& error) { |
| 801 | ShowConfirmation(); |
| 802 | } |
| 803 | |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 804 | void ExtensionInstallPrompt::ShowConfirmation() { |
[email protected] | 62a28d7c | 2013-12-28 01:34:49 | [diff] [blame] | 805 | if (prompt_.type() == INSTALL_PROMPT) |
| 806 | prompt_.set_experiment(ExtensionInstallPromptExperiment::Find()); |
| 807 | else |
| 808 | prompt_.set_experiment(ExtensionInstallPromptExperiment::ControlGroup()); |
| 809 | |
[email protected] | dc24976f | 2013-06-02 21:15:09 | [diff] [blame] | 810 | if (permissions_.get() && |
[email protected] | 13c68b6 | 2013-05-17 11:29:05 | [diff] [blame] | 811 | (!extension_ || |
| 812 | !extensions::PermissionsData::ShouldSkipPermissionWarnings( |
| 813 | extension_))) { |
[email protected] | 1d5e58b | 2013-01-31 08:41:40 | [diff] [blame] | 814 | Manifest::Type extension_type = extension_ ? |
| 815 | extension_->GetType() : Manifest::TYPE_UNKNOWN; |
[email protected] | 8ab7e6c | 2013-07-11 21:15:03 | [diff] [blame] | 816 | prompt_.SetPermissions( |
[email protected] | c4100347 | 2013-10-19 15:37:25 | [diff] [blame] | 817 | extensions::PermissionMessageProvider::Get()-> |
| 818 | GetWarningMessages(permissions_, extension_type)); |
[email protected] | 8ab7e6c | 2013-07-11 21:15:03 | [diff] [blame] | 819 | prompt_.SetPermissionsDetails( |
[email protected] | c4100347 | 2013-10-19 15:37:25 | [diff] [blame] | 820 | extensions::PermissionMessageProvider::Get()-> |
| 821 | GetWarningMessagesDetails(permissions_, extension_type)); |
[email protected] | bebe1d0 | 2012-08-02 20:17:09 | [diff] [blame] | 822 | } |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 823 | |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 824 | switch (prompt_.type()) { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 825 | case PERMISSIONS_PROMPT: |
| 826 | case RE_ENABLE_PROMPT: |
| 827 | case INLINE_INSTALL_PROMPT: |
[email protected] | 612a1cb1 | 2012-10-17 13:18:03 | [diff] [blame] | 828 | case EXTERNAL_INSTALL_PROMPT: |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 829 | case INSTALL_PROMPT: |
[email protected] | 1a93d8d | 2013-10-27 23:09:20 | [diff] [blame] | 830 | case LAUNCH_PROMPT: |
[email protected] | 15d267b4 | 2013-02-14 23:43:32 | [diff] [blame] | 831 | case POST_INSTALL_PERMISSIONS_PROMPT: { |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 832 | prompt_.set_extension(extension_); |
[email protected] | 32e7a9b | 2013-01-23 23:00:19 | [diff] [blame] | 833 | prompt_.set_icon(gfx::Image::CreateFrom1xBitmap(icon_)); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 834 | break; |
| 835 | } |
| 836 | case BUNDLE_INSTALL_PROMPT: { |
| 837 | prompt_.set_bundle(bundle_); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 838 | break; |
| 839 | } |
| 840 | default: |
| 841 | NOTREACHED() << "Unknown message"; |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 842 | return; |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 843 | } |
[email protected] | af6efb2 | 2012-10-12 02:23:05 | [diff] [blame] | 844 | |
| 845 | if (AutoConfirmPrompt(delegate_)) |
| 846 | return; |
| 847 | |
[email protected] | 5db2e88 | 2012-12-20 10:17:26 | [diff] [blame] | 848 | if (show_dialog_callback_.is_null()) |
| 849 | GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); |
| 850 | else |
| 851 | show_dialog_callback_.Run(show_params_, delegate_, prompt_); |
[email protected] | c82da8c4 | 2012-06-08 19:49:11 | [diff] [blame] | 852 | } |