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/ui/views/extensions/extension_installed_bubble.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/extensions/extension_install_ui.h" | 14 #include "chrome/browser/extensions/extension_install_ui.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/views/browser_actions_container.h" | 18 #include "chrome/browser/ui/views/browser_actions_container.h" |
19 #include "chrome/browser/ui/views/frame/browser_view.h" | 19 #include "chrome/browser/ui/views/frame/browser_view.h" |
20 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 20 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
21 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 21 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
22 #include "chrome/browser/ui/views/toolbar_view.h" | 22 #include "chrome/browser/ui/views/toolbar_view.h" |
23 #include "chrome/browser/ui/views/window.h" | 23 #include "chrome/browser/ui/views/window.h" |
24 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
25 #include "chrome/common/extensions/extension.h" | 25 #include "chrome/common/extensions/extension.h" |
26 #include "chrome/common/extensions/extension_action.h" | 26 #include "chrome/common/extensions/extension_action.h" |
27 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
28 #include "content/public/browser/notification_source.h" | 28 #include "content/public/browser/notification_source.h" |
| 29 #include "grit/chromium_strings.h" |
29 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
30 #include "grit/theme_resources_standard.h" | 31 #include "grit/theme_resources_standard.h" |
31 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
33 #include "ui/views/controls/button/image_button.h" | 34 #include "ui/views/controls/button/image_button.h" |
34 #include "ui/views/controls/image_view.h" | 35 #include "ui/views/controls/image_view.h" |
35 #include "ui/views/controls/label.h" | 36 #include "ui/views/controls/label.h" |
36 #include "ui/views/controls/link.h" | 37 #include "ui/views/controls/link.h" |
37 #include "ui/views/controls/link_listener.h" | 38 #include "ui/views/controls/link_listener.h" |
38 #include "ui/views/layout/fill_layout.h" | 39 #include "ui/views/layout/fill_layout.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 gfx::Size size(icon->width(), icon->height()); | 106 gfx::Size size(icon->width(), icon->height()); |
106 if (size.width() > kIconSize || size.height() > kIconSize) | 107 if (size.width() > kIconSize || size.height() > kIconSize) |
107 size = gfx::Size(kIconSize, kIconSize); | 108 size = gfx::Size(kIconSize, kIconSize); |
108 icon_ = new views::ImageView(); | 109 icon_ = new views::ImageView(); |
109 icon_->SetImageSize(size); | 110 icon_->SetImageSize(size); |
110 icon_->SetImage(*icon); | 111 icon_->SetImage(*icon); |
111 AddChildView(icon_); | 112 AddChildView(icon_); |
112 | 113 |
113 string16 extension_name = UTF8ToUTF16(extension->name()); | 114 string16 extension_name = UTF8ToUTF16(extension->name()); |
114 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 115 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
115 heading_ = new views::Label( | 116 heading_ = new views::Label(l10n_util::GetStringFUTF16( |
116 l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, | 117 IDS_EXTENSION_INSTALLED_HEADING, |
117 extension_name)); | 118 extension_name, |
| 119 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); |
118 heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); | 120 heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); |
119 heading_->SetMultiLine(true); | 121 heading_->SetMultiLine(true); |
120 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 122 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
121 AddChildView(heading_); | 123 AddChildView(heading_); |
122 | 124 |
123 switch (type_) { | 125 switch (type_) { |
124 case ExtensionInstalledBubble::PAGE_ACTION: { | 126 case ExtensionInstalledBubble::PAGE_ACTION: { |
125 info_ = new views::Label(l10n_util::GetStringUTF16( | 127 info_ = new views::Label(l10n_util::GetStringUTF16( |
126 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); | 128 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); |
127 info_->SetFont(font); | 129 info_->SetFont(font); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 } | 416 } |
415 | 417 |
416 void ExtensionInstalledBubble::WindowClosing() { | 418 void ExtensionInstalledBubble::WindowClosing() { |
417 if (extension_ && type_ == PAGE_ACTION) { | 419 if (extension_ && type_ == PAGE_ACTION) { |
418 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 420 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
419 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 421 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
420 extension_->page_action(), | 422 extension_->page_action(), |
421 false); // preview_enabled | 423 false); // preview_enabled |
422 } | 424 } |
423 } | 425 } |
OLD | NEW |