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 20 matching lines...) Expand all Loading... |
31 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
32 #include "chrome/common/extensions/extension_icon_set.h" | 32 #include "chrome/common/extensions/extension_icon_set.h" |
33 #include "chrome/common/extensions/extension_resource.h" | 33 #include "chrome/common/extensions/extension_resource.h" |
34 #include "chrome/common/extensions/url_pattern.h" | 34 #include "chrome/common/extensions/url_pattern.h" |
35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
36 #include "content/common/notification_service.h" | 36 #include "content/common/notification_service.h" |
37 #include "grit/chromium_strings.h" | 37 #include "grit/chromium_strings.h" |
38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
39 #include "grit/theme_resources.h" | 39 #include "grit/theme_resources.h" |
40 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
| 41 #include "ui/base/resource/resource_bundle.h" |
41 | 42 |
42 static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { | 43 static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { |
43 IDS_EXTENSION_INSTALL_PROMPT_TITLE, | 44 IDS_EXTENSION_INSTALL_PROMPT_TITLE, |
44 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, | 45 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, |
45 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, | 46 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, |
46 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE | 47 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE |
47 }; | 48 }; |
48 static const int kHeadingIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { | 49 static const int kHeadingIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { |
49 IDS_EXTENSION_INSTALL_PROMPT_HEADING, | 50 IDS_EXTENSION_INSTALL_PROMPT_HEADING, |
50 IDS_EXTENSION_INSTALL_PROMPT_HEADING, | 51 IDS_EXTENSION_INSTALL_PROMPT_HEADING, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 double rating_fractional = average_rating_ - rating_integer; | 143 double rating_fractional = average_rating_ - rating_integer; |
143 | 144 |
144 if (rating_fractional > 0.66) { | 145 if (rating_fractional > 0.66) { |
145 rating_integer++; | 146 rating_integer++; |
146 } | 147 } |
147 | 148 |
148 if (rating_fractional < 0.33 || rating_fractional > 0.66) { | 149 if (rating_fractional < 0.33 || rating_fractional > 0.66) { |
149 rating_fractional = 0; | 150 rating_fractional = 0; |
150 } | 151 } |
151 | 152 |
| 153 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
152 int i; | 154 int i; |
153 for (i = 0; i < rating_integer; i++) { | 155 for (i = 0; i < rating_integer; i++) { |
154 appender(IDR_EXTENSIONS_RATING_STAR_ON, data); | 156 appender(rb.GetBitmapNamed(IDR_EXTENSIONS_RATING_STAR_ON), data); |
155 } | 157 } |
156 if (rating_fractional) { | 158 if (rating_fractional) { |
157 appender(IDR_EXTENSIONS_RATING_STAR_HALF_LEFT, data); | 159 appender(rb.GetBitmapNamed(IDR_EXTENSIONS_RATING_STAR_HALF_LEFT), data); |
158 i++; | 160 i++; |
159 } | 161 } |
160 for (; i < kMaxExtensionRating; i++) { | 162 for (; i < kMaxExtensionRating; i++) { |
161 appender(IDR_EXTENSIONS_RATING_STAR_OFF, data); | 163 appender(rb.GetBitmapNamed(IDR_EXTENSIONS_RATING_STAR_OFF), data); |
162 } | 164 } |
163 } | 165 } |
164 | 166 |
165 string16 ExtensionInstallUI::Prompt::GetRatingCount() const { | 167 string16 ExtensionInstallUI::Prompt::GetRatingCount() const { |
166 CHECK_EQ(INLINE_INSTALL_PROMPT, type_); | 168 CHECK_EQ(INLINE_INSTALL_PROMPT, type_); |
167 return l10n_util::GetStringFUTF16( | 169 return l10n_util::GetStringFUTF16( |
168 IDS_EXTENSION_RATING_COUNT, | 170 IDS_EXTENSION_RATING_COUNT, |
169 UTF8ToUTF16(base::IntToString(rating_count_))); | 171 UTF8ToUTF16(base::IntToString(rating_count_))); |
170 } | 172 } |
171 | 173 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 413 |
412 InfoBarDelegate* ExtensionInstallUI::GetNewThemeInstalledInfoBarDelegate( | 414 InfoBarDelegate* ExtensionInstallUI::GetNewThemeInstalledInfoBarDelegate( |
413 TabContents* tab_contents, | 415 TabContents* tab_contents, |
414 const Extension* new_theme, | 416 const Extension* new_theme, |
415 const std::string& previous_theme_id, | 417 const std::string& previous_theme_id, |
416 bool previous_using_native_theme) { | 418 bool previous_using_native_theme) { |
417 return new ThemeInstalledInfoBarDelegate(tab_contents, new_theme, | 419 return new ThemeInstalledInfoBarDelegate(tab_contents, new_theme, |
418 previous_theme_id, | 420 previous_theme_id, |
419 previous_using_native_theme); | 421 previous_using_native_theme); |
420 } | 422 } |
OLD | NEW |