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" | |
30 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
31 #include "grit/theme_resources_standard.h" | 30 #include "grit/theme_resources_standard.h" |
32 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
33 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
34 #include "ui/views/controls/button/image_button.h" | 33 #include "ui/views/controls/button/image_button.h" |
35 #include "ui/views/controls/image_view.h" | 34 #include "ui/views/controls/image_view.h" |
36 #include "ui/views/controls/label.h" | 35 #include "ui/views/controls/label.h" |
37 #include "ui/views/controls/link.h" | 36 #include "ui/views/controls/link.h" |
38 #include "ui/views/controls/link_listener.h" | 37 #include "ui/views/controls/link_listener.h" |
39 #include "ui/views/layout/fill_layout.h" | 38 #include "ui/views/layout/fill_layout.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 gfx::Size size(icon->width(), icon->height()); | 105 gfx::Size size(icon->width(), icon->height()); |
107 if (size.width() > kIconSize || size.height() > kIconSize) | 106 if (size.width() > kIconSize || size.height() > kIconSize) |
108 size = gfx::Size(kIconSize, kIconSize); | 107 size = gfx::Size(kIconSize, kIconSize); |
109 icon_ = new views::ImageView(); | 108 icon_ = new views::ImageView(); |
110 icon_->SetImageSize(size); | 109 icon_->SetImageSize(size); |
111 icon_->SetImage(*icon); | 110 icon_->SetImage(*icon); |
112 AddChildView(icon_); | 111 AddChildView(icon_); |
113 | 112 |
114 string16 extension_name = UTF8ToUTF16(extension->name()); | 113 string16 extension_name = UTF8ToUTF16(extension->name()); |
115 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 114 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
116 heading_ = new views::Label(l10n_util::GetStringFUTF16( | 115 heading_ = new views::Label( |
117 IDS_EXTENSION_INSTALLED_HEADING, | 116 l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, |
118 extension_name, | 117 extension_name)); |
119 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); | |
120 heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); | 118 heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); |
121 heading_->SetMultiLine(true); | 119 heading_->SetMultiLine(true); |
122 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 120 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
123 AddChildView(heading_); | 121 AddChildView(heading_); |
124 | 122 |
125 switch (type_) { | 123 switch (type_) { |
126 case ExtensionInstalledBubble::PAGE_ACTION: { | 124 case ExtensionInstalledBubble::PAGE_ACTION: { |
127 info_ = new views::Label(l10n_util::GetStringUTF16( | 125 info_ = new views::Label(l10n_util::GetStringUTF16( |
128 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); | 126 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); |
129 info_->SetFont(font); | 127 info_->SetFont(font); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 } | 414 } |
417 | 415 |
418 void ExtensionInstalledBubble::WindowClosing() { | 416 void ExtensionInstalledBubble::WindowClosing() { |
419 if (extension_ && type_ == PAGE_ACTION) { | 417 if (extension_ && type_ == PAGE_ACTION) { |
420 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 418 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
421 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 419 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
422 extension_->page_action(), | 420 extension_->page_action(), |
423 false); // preview_enabled | 421 false); // preview_enabled |
424 } | 422 } |
425 } | 423 } |
OLD | NEW |