OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ui.h" | 5 #include "chrome/browser/extensions/extension_install_ui.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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "chrome/common/extensions/url_pattern.h" | 35 #include "chrome/common/extensions/url_pattern.h" |
36 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
38 #include "grit/chromium_strings.h" | 38 #include "grit/chromium_strings.h" |
39 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
40 #include "grit/theme_resources.h" | 40 #include "grit/theme_resources.h" |
41 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
42 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
43 | 43 |
44 static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { | 44 static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { |
45 0, | 45 IDS_EXTENSION_INSTALL_PROMPT_TITLE, |
46 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, | 46 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, |
47 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, | 47 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, |
48 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE | 48 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE |
49 }; | 49 }; |
50 static const int kHeadingIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { | 50 static const int kHeadingIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { |
51 IDS_EXTENSION_INSTALL_PROMPT_HEADING, | 51 IDS_EXTENSION_INSTALL_PROMPT_HEADING, |
52 IDS_EXTENSION_INSTALL_PROMPT_HEADING, | 52 IDS_EXTENSION_INSTALL_PROMPT_HEADING, |
53 IDS_EXTENSION_RE_ENABLE_PROMPT_HEADING, | 53 IDS_EXTENSION_RE_ENABLE_PROMPT_HEADING, |
54 IDS_EXTENSION_PERMISSIONS_PROMPT_HEADING | 54 IDS_EXTENSION_PERMISSIONS_PROMPT_HEADING |
55 }; | 55 }; |
56 static const int kAcceptButtonIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { | 56 static const int kAcceptButtonIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { |
57 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, | 57 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, |
58 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, | 58 IDS_EXTENSION_PROMPT_INLINE_INSTALL_BUTTON, |
59 IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON, | 59 IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON, |
60 IDS_EXTENSION_PROMPT_PERMISSIONS_BUTTON | 60 IDS_EXTENSION_PROMPT_PERMISSIONS_BUTTON |
61 }; | 61 }; |
62 static const int kAbortButtonIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { | 62 static const int kAbortButtonIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { |
63 0, | 63 0, |
64 0, | 64 0, |
65 0, | 65 0, |
66 IDS_EXTENSION_PROMPT_PERMISSIONS_ABORT_BUTTON | 66 IDS_EXTENSION_PROMPT_PERMISSIONS_ABORT_BUTTON |
67 }; | 67 }; |
68 static const int kPermissionsHeaderIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { | 68 static const int kPermissionsHeaderIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { |
(...skipping 27 matching lines...) Expand all Loading... |
96 void ExtensionInstallUI::Prompt::SetInlineInstallWebstoreData( | 96 void ExtensionInstallUI::Prompt::SetInlineInstallWebstoreData( |
97 std::string localized_user_count, | 97 std::string localized_user_count, |
98 double average_rating, | 98 double average_rating, |
99 int rating_count) { | 99 int rating_count) { |
100 CHECK_EQ(INLINE_INSTALL_PROMPT, type_); | 100 CHECK_EQ(INLINE_INSTALL_PROMPT, type_); |
101 localized_user_count_ = localized_user_count; | 101 localized_user_count_ = localized_user_count; |
102 average_rating_ = average_rating; | 102 average_rating_ = average_rating; |
103 rating_count_ = rating_count; | 103 rating_count_ = rating_count; |
104 } | 104 } |
105 | 105 |
106 string16 ExtensionInstallUI::Prompt::GetDialogTitle( | 106 string16 ExtensionInstallUI::Prompt::GetDialogTitle() const { |
107 const Extension* extension) const { | 107 if (type_ == INLINE_INSTALL_PROMPT) { |
108 if (type_ == INSTALL_PROMPT) { | |
109 return l10n_util::GetStringUTF16(extension->is_app() ? | |
110 IDS_EXTENSION_INSTALL_APP_PROMPT_TITLE : | |
111 IDS_EXTENSION_INSTALL_EXTENSION_PROMPT_TITLE); | |
112 } else if (type_ == INLINE_INSTALL_PROMPT) { | |
113 return l10n_util::GetStringFUTF16( | 108 return l10n_util::GetStringFUTF16( |
114 kTitleIds[type_], l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); | 109 kTitleIds[type_], l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); |
115 } else { | 110 } else { |
116 return l10n_util::GetStringUTF16(kTitleIds[type_]); | 111 return l10n_util::GetStringUTF16(kTitleIds[type_]); |
117 } | 112 } |
118 } | 113 } |
119 | 114 |
120 string16 ExtensionInstallUI::Prompt::GetHeading(std::string extension_name) | 115 string16 ExtensionInstallUI::Prompt::GetHeading(std::string extension_name) |
121 const { | 116 const { |
122 if (type_ == INLINE_INSTALL_PROMPT) { | 117 if (type_ == INLINE_INSTALL_PROMPT) { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 bool previous_using_native_theme) { | 426 bool previous_using_native_theme) { |
432 Profile* profile = tab_contents->profile(); | 427 Profile* profile = tab_contents->profile(); |
433 return new ThemeInstalledInfoBarDelegate( | 428 return new ThemeInstalledInfoBarDelegate( |
434 tab_contents->infobar_tab_helper(), | 429 tab_contents->infobar_tab_helper(), |
435 profile->GetExtensionService(), | 430 profile->GetExtensionService(), |
436 ThemeServiceFactory::GetForProfile(profile), | 431 ThemeServiceFactory::GetForProfile(profile), |
437 new_theme, | 432 new_theme, |
438 previous_theme_id, | 433 previous_theme_id, |
439 previous_using_native_theme); | 434 previous_using_native_theme); |
440 } | 435 } |
OLD | NEW |