Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: chrome/browser/extensions/extension_install_prompt.cc

Issue 26466006: Update default app first run dialog to match new mocks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed changes that should go to separate CL Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_install_prompt.h" 5 #include "chrome/browser/extensions/extension_install_prompt.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 namespace { 52 namespace {
53 53
54 static const int kTitleIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 54 static const int kTitleIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
55 0, // The regular install prompt depends on what's being installed. 55 0, // The regular install prompt depends on what's being installed.
56 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, 56 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE,
57 IDS_EXTENSION_INSTALL_PROMPT_TITLE, 57 IDS_EXTENSION_INSTALL_PROMPT_TITLE,
58 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, 58 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE,
59 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE, 59 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE,
60 IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_TITLE, 60 IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_TITLE,
61 IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_TITLE, 61 IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_TITLE,
62 0, // The prompt should be extension description. 62 IDS_EXTENSION_FIRST_RUN_PROMPT_TITLE,
63 }; 63 };
64 static const int kHeadingIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 64 static const int kHeadingIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
65 IDS_EXTENSION_INSTALL_PROMPT_HEADING, 65 IDS_EXTENSION_INSTALL_PROMPT_HEADING,
66 0, // Inline installs use the extension name. 66 0, // Inline installs use the extension name.
67 0, // Heading for bundle installs depends on the bundle contents. 67 0, // Heading for bundle installs depends on the bundle contents.
68 IDS_EXTENSION_RE_ENABLE_PROMPT_HEADING, 68 IDS_EXTENSION_RE_ENABLE_PROMPT_HEADING,
69 IDS_EXTENSION_PERMISSIONS_PROMPT_HEADING, 69 IDS_EXTENSION_PERMISSIONS_PROMPT_HEADING,
70 0, // External installs use different strings for extensions/apps. 70 0, // External installs use different strings for extensions/apps.
71 IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_HEADING, 71 IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_HEADING,
72 0, // First run dialog use the extension name. 72 IDS_EXTENSION_FIRST_RUN_PROMPT_HEADING,
73 }; 73 };
74 static const int kButtons[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 74 static const int kButtons[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
75 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 75 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
76 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 76 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
77 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 77 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
78 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, 79 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
80 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 80 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
81 ui::DIALOG_BUTTON_CANCEL, 81 ui::DIALOG_BUTTON_CANCEL,
82 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 82 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
83 }; 83 };
84 static const int kAcceptButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 84 static const int kAcceptButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
85 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, 85 IDS_EXTENSION_PROMPT_INSTALL_BUTTON,
86 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, 86 IDS_EXTENSION_PROMPT_INSTALL_BUTTON,
87 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, 87 IDS_EXTENSION_PROMPT_INSTALL_BUTTON,
88 IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON, 88 IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON,
89 IDS_EXTENSION_PROMPT_PERMISSIONS_BUTTON, 89 IDS_EXTENSION_PROMPT_PERMISSIONS_BUTTON,
90 0, // External installs use different strings for extensions/apps. 90 0, // External installs use different strings for extensions/apps.
91 IDS_EXTENSION_PROMPT_PERMISSIONS_CLEAR_RETAINED_FILES_BUTTON, 91 IDS_EXTENSION_PROMPT_PERMISSIONS_CLEAR_RETAINED_FILES_BUTTON,
92 IDS_EXTENSION_PROMPT_FIRST_RUN_ACCEPT_BUTTON 92 IDS_EXTENSION_PROMPT_FIRST_RUN_ACCEPT_BUTTON
93 }; 93 };
94 static const int kAbortButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 94 static const int kAbortButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
95 0, // These all use the platform's default cancel label. 95 0, // These all use the platform's default cancel label.
96 0, 96 0,
97 0, 97 0,
98 0, 98 0,
99 IDS_EXTENSION_PROMPT_PERMISSIONS_ABORT_BUTTON, 99 IDS_EXTENSION_PROMPT_PERMISSIONS_ABORT_BUTTON,
100 IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_ABORT_BUTTON, 100 IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_ABORT_BUTTON,
101 IDS_CLOSE, 101 IDS_CLOSE,
102 IDS_EXTENSION_PROMPT_FIRST_RUN_DECLINE_BUTTON 102 0, // Platform dependent cancel button.
103 }; 103 };
104 static const int kPermissionsHeaderIds[ 104 static const int kPermissionsHeaderIds[
105 ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 105 ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
106 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, 106 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO,
107 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, 107 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO,
108 IDS_EXTENSION_PROMPT_THESE_WILL_HAVE_ACCESS_TO, 108 IDS_EXTENSION_PROMPT_THESE_WILL_HAVE_ACCESS_TO,
109 IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO, 109 IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO,
110 IDS_EXTENSION_PROMPT_WANTS_ACCESS_TO, 110 IDS_EXTENSION_PROMPT_WANTS_ACCESS_TO,
111 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, 111 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO,
112 IDS_EXTENSION_PROMPT_CAN_ACCESS, 112 IDS_EXTENSION_PROMPT_CAN_ACCESS,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 if (type_ == INSTALL_PROMPT) { 270 if (type_ == INSTALL_PROMPT) {
271 if (extension_->is_app()) 271 if (extension_->is_app())
272 resource_id = IDS_EXTENSION_INSTALL_APP_PROMPT_TITLE; 272 resource_id = IDS_EXTENSION_INSTALL_APP_PROMPT_TITLE;
273 else if (extension_->is_theme()) 273 else if (extension_->is_theme())
274 resource_id = IDS_EXTENSION_INSTALL_THEME_PROMPT_TITLE; 274 resource_id = IDS_EXTENSION_INSTALL_THEME_PROMPT_TITLE;
275 else 275 else
276 resource_id = IDS_EXTENSION_INSTALL_EXTENSION_PROMPT_TITLE; 276 resource_id = IDS_EXTENSION_INSTALL_EXTENSION_PROMPT_TITLE;
277 } else if (type_ == EXTERNAL_INSTALL_PROMPT) { 277 } else if (type_ == EXTERNAL_INSTALL_PROMPT) {
278 return l10n_util::GetStringFUTF16( 278 return l10n_util::GetStringFUTF16(
279 resource_id, UTF8ToUTF16(extension_->name())); 279 resource_id, UTF8ToUTF16(extension_->name()));
280 } else if (type_ == DEFAULT_INSTALL_FIRST_RUN_PROMPT) {
281 return UTF8ToUTF16(extension_->name());
282 } 280 }
283 281
284 return l10n_util::GetStringUTF16(resource_id); 282 return l10n_util::GetStringUTF16(resource_id);
285 } 283 }
286 284
287 string16 ExtensionInstallPrompt::Prompt::GetHeading() const { 285 string16 ExtensionInstallPrompt::Prompt::GetHeading() const {
288 if (type_ == INLINE_INSTALL_PROMPT) { 286 if (type_ == INLINE_INSTALL_PROMPT) {
289 return UTF8ToUTF16(extension_->name()); 287 return UTF8ToUTF16(extension_->name());
290 } else if (type_ == BUNDLE_INSTALL_PROMPT) { 288 } else if (type_ == BUNDLE_INSTALL_PROMPT) {
291 return bundle_->GetHeadingTextFor(BundleInstaller::Item::STATE_PENDING); 289 return bundle_->GetHeadingTextFor(BundleInstaller::Item::STATE_PENDING);
292 } else if (type_ == EXTERNAL_INSTALL_PROMPT) { 290 } else if (type_ == EXTERNAL_INSTALL_PROMPT) {
293 int resource_id = -1; 291 int resource_id = -1;
294 if (extension_->is_app()) 292 if (extension_->is_app())
295 resource_id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_HEADING_APP; 293 resource_id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_HEADING_APP;
296 else if (extension_->is_theme()) 294 else if (extension_->is_theme())
297 resource_id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_HEADING_THEME; 295 resource_id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_HEADING_THEME;
298 else 296 else
299 resource_id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_HEADING_EXTENSION; 297 resource_id = IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_HEADING_EXTENSION;
300 return l10n_util::GetStringUTF16(resource_id); 298 return l10n_util::GetStringUTF16(resource_id);
301 } else if (type_ == DEFAULT_INSTALL_FIRST_RUN_PROMPT) {
302 return UTF8ToUTF16(extension_->description());
303 } else { 299 } else {
304 return l10n_util::GetStringFUTF16( 300 return l10n_util::GetStringFUTF16(
305 kHeadingIds[type_], UTF8ToUTF16(extension_->name())); 301 kHeadingIds[type_], UTF8ToUTF16(extension_->name()));
306 } 302 }
307 } 303 }
308 304
309 int ExtensionInstallPrompt::Prompt::GetDialogButtons() const { 305 int ExtensionInstallPrompt::Prompt::GetDialogButtons() const {
310 if (type_ == POST_INSTALL_PERMISSIONS_PROMPT && 306 if (type_ == POST_INSTALL_PERMISSIONS_PROMPT &&
311 ShouldDisplayRevokeFilesButton()) { 307 ShouldDisplayRevokeFilesButton()) {
312 return kButtons[type_] | ui::DIALOG_BUTTON_OK; 308 return kButtons[type_] | ui::DIALOG_BUTTON_OK;
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 } 828 }
833 829
834 if (AutoConfirmPrompt(delegate_)) 830 if (AutoConfirmPrompt(delegate_))
835 return; 831 return;
836 832
837 if (show_dialog_callback_.is_null()) 833 if (show_dialog_callback_.is_null())
838 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); 834 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_);
839 else 835 else
840 show_dialog_callback_.Run(show_params_, delegate_, prompt_); 836 show_dialog_callback_.Run(show_params_, delegate_, prompt_);
841 } 837 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/views/extensions/extension_install_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698