OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/chrome_notification_types.h" | |
13 #include "chrome/browser/extensions/api/commands/command_service.h" | |
14 #include "chrome/browser/extensions/extension_action.h" | 12 #include "chrome/browser/extensions/extension_action.h" |
15 #include "chrome/browser/extensions/extension_action_manager.h" | 13 #include "chrome/browser/extensions/extension_action_manager.h" |
16 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/signin/signin_promo.h" | 15 #include "chrome/browser/signin/signin_promo.h" |
18 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/browser/ui/chrome_pages.h" | 18 #include "chrome/browser/ui/chrome_pages.h" |
21 #include "chrome/browser/ui/singleton_tabs.h" | 19 #include "chrome/browser/ui/singleton_tabs.h" |
22 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 20 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
23 #include "chrome/browser/ui/views/frame/browser_view.h" | 21 #include "chrome/browser/ui/views/frame/browser_view.h" |
24 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
25 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 23 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
26 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 24 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
27 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 25 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
28 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" | 26 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" |
29 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 27 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
30 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h" | 28 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h" |
31 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" | |
32 #include "chrome/common/extensions/sync_helper.h" | 29 #include "chrome/common/extensions/sync_helper.h" |
33 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
34 #include "chrome/grit/chromium_strings.h" | 31 #include "chrome/grit/chromium_strings.h" |
35 #include "chrome/grit/generated_resources.h" | 32 #include "chrome/grit/generated_resources.h" |
36 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
37 #include "extensions/common/feature_switch.h" | 34 #include "extensions/common/feature_switch.h" |
38 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
39 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
40 #include "ui/gfx/render_text.h" | 37 #include "ui/gfx/render_text.h" |
41 #include "ui/gfx/text_elider.h" | 38 #include "ui/gfx/text_elider.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 79 |
83 } // namespace chrome | 80 } // namespace chrome |
84 | 81 |
85 // InstalledBubbleContent is the content view which is placed in the | 82 // InstalledBubbleContent is the content view which is placed in the |
86 // ExtensionInstalledBubbleView. It displays the install icon and explanatory | 83 // ExtensionInstalledBubbleView. It displays the install icon and explanatory |
87 // text about the installed extension. | 84 // text about the installed extension. |
88 class InstalledBubbleContent : public views::View, | 85 class InstalledBubbleContent : public views::View, |
89 public views::ButtonListener, | 86 public views::ButtonListener, |
90 public views::LinkListener { | 87 public views::LinkListener { |
91 public: | 88 public: |
92 InstalledBubbleContent(Browser* browser, | 89 InstalledBubbleContent(const ExtensionInstalledBubble& bubble, |
93 const Extension* extension, | 90 Browser* browser); |
94 ExtensionInstalledBubble::BubbleType type, | |
95 const SkBitmap* icon); | |
96 | 91 |
97 // Overridden from views::ButtonListener. | 92 // Overridden from views::ButtonListener. |
98 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 93 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
99 | 94 |
100 // Overriden from views::LinkListener. | 95 // Overriden from views::LinkListener. |
101 void LinkClicked(views::Link* source, int event_flags) override; | 96 void LinkClicked(views::Link* source, int event_flags) override; |
102 | 97 |
103 private: | 98 private: |
104 enum Flavors { | 99 enum Flavors { |
105 NONE = 0, | 100 NONE = 0, |
106 HOW_TO_USE = 1 << 0, | 101 HOW_TO_USE = 1 << 0, |
107 HOW_TO_MANAGE = 1 << 1, | 102 HOW_TO_MANAGE = 1 << 1, |
108 SHOW_KEYBINDING = 1 << 2, | 103 SHOW_KEYBINDING = 1 << 2, |
109 SIGN_IN_PROMO = 1 << 3, | 104 SIGN_IN_PROMO = 1 << 3, |
110 }; | 105 }; |
111 | 106 |
112 bool GetKeybinding(extensions::Command* command); | |
113 base::string16 GetHowToUseDescription(const base::string16& key); | |
114 | |
115 // Layout the signin promo at coordinates |offset_x| and |offset_y|. Returns | 107 // Layout the signin promo at coordinates |offset_x| and |offset_y|. Returns |
116 // the height (in pixels) of the promo UI. | 108 // the height (in pixels) of the promo UI. |
117 int LayoutSigninPromo(int offset_x, int offset_y); | 109 int LayoutSigninPromo(int offset_x, int offset_y); |
118 | 110 |
119 // Overriden from views::View. | 111 // Overriden from views::View. |
120 gfx::Size GetPreferredSize() const override; | 112 gfx::Size GetPreferredSize() const override; |
121 void Layout() override; | 113 void Layout() override; |
122 void OnPaint(gfx::Canvas* canvas) override; | 114 void OnPaint(gfx::Canvas* canvas) override; |
123 | 115 |
124 // The browser we're associated with. | 116 // The browser we're associated with. |
125 Browser* browser_; | 117 Browser* browser_; |
126 | 118 |
127 // The id of the extension just installed. | |
128 const std::string extension_id_; | |
129 | |
130 // The string that contains the link text at the beginning of the sign-in | 119 // The string that contains the link text at the beginning of the sign-in |
131 // promo text. | 120 // promo text. |
132 base::string16 signin_promo_link_text_; | 121 base::string16 signin_promo_link_text_; |
133 // The remaining text of the sign-in promo text. | 122 // The remaining text of the sign-in promo text. |
134 base::string16 signin_promo_text_; | 123 base::string16 signin_promo_text_; |
135 | 124 |
136 // A vector of RenderText objects representing the full sign-in promo | 125 // A vector of RenderText objects representing the full sign-in promo |
137 // paragraph as layed out within the bubble, but has the text of the link | 126 // paragraph as layed out within the bubble, but has the text of the link |
138 // whited out so the link can be drawn in its place. | 127 // whited out so the link can be drawn in its place. |
139 ScopedVector<gfx::RenderText> sign_in_promo_lines_; | 128 ScopedVector<gfx::RenderText> sign_in_promo_lines_; |
140 | 129 |
141 // The type of the bubble to show (Browser Action, Omnibox keyword, etc). | |
142 ExtensionInstalledBubble::BubbleType type_; | |
143 | |
144 // A bitmask containing the various flavors of bubble sections to show. | 130 // A bitmask containing the various flavors of bubble sections to show. |
145 int flavors_; | 131 int flavors_; |
146 | 132 |
147 // The height, in pixels, of the sign-in promo. | 133 // The height, in pixels, of the sign-in promo. |
148 size_t height_of_signin_promo_; | 134 size_t height_of_signin_promo_; |
149 | 135 |
150 views::ImageView* icon_; | 136 views::ImageView* icon_; |
151 views::Label* heading_; | 137 views::Label* heading_; |
152 views::Label* how_to_use_; | 138 views::Label* how_to_use_; |
153 views::Link* sign_in_link_; | 139 views::Link* sign_in_link_; |
154 views::Label* manage_; | 140 views::Label* manage_; |
155 views::Link* manage_shortcut_; | 141 views::Link* manage_shortcut_; |
156 views::ImageButton* close_button_; | 142 views::ImageButton* close_button_; |
157 | 143 |
158 DISALLOW_COPY_AND_ASSIGN(InstalledBubbleContent); | 144 DISALLOW_COPY_AND_ASSIGN(InstalledBubbleContent); |
159 }; | 145 }; |
160 | 146 |
161 InstalledBubbleContent::InstalledBubbleContent( | 147 InstalledBubbleContent::InstalledBubbleContent( |
162 Browser* browser, | 148 const ExtensionInstalledBubble& bubble, |
163 const Extension* extension, | 149 Browser* browser) |
164 ExtensionInstalledBubble::BubbleType type, | |
165 const SkBitmap* icon) | |
166 : browser_(browser), | 150 : browser_(browser), |
167 extension_id_(extension->id()), | |
168 type_(type), | |
169 flavors_(NONE), | 151 flavors_(NONE), |
170 height_of_signin_promo_(0u), | 152 height_of_signin_promo_(0u), |
171 how_to_use_(NULL), | 153 how_to_use_(NULL), |
172 sign_in_link_(NULL), | 154 sign_in_link_(NULL), |
173 manage_(NULL), | 155 manage_(NULL), |
174 manage_shortcut_(NULL) { | 156 manage_shortcut_(NULL) { |
175 // The Extension Installed bubble takes on various forms, depending on the | 157 // The Extension Installed bubble takes on various forms, depending on the |
176 // type of extension installed. In general, though, they are all similar: | 158 // type of extension installed. In general, though, they are all similar: |
177 // | 159 // |
178 // ------------------------- | 160 // ------------------------- |
179 // | | Heading [X] | | 161 // | | Heading [X] | |
180 // | Icon | Info | | 162 // | Icon | Info | |
181 // | | Extra info | | 163 // | | Extra info | |
182 // ------------------------- | 164 // ------------------------- |
183 // | 165 // |
184 // Icon and Heading are always shown (as well as the close button). | 166 // Icon and Heading are always shown (as well as the close button). |
185 // Info is shown for browser actions, page actions and Omnibox keyword | 167 // Info is shown for browser actions, page actions and Omnibox keyword |
186 // extensions and might list keyboard shorcut for the former two types. | 168 // extensions and might list keyboard shorcut for the former two types. |
187 // Extra info is... | 169 // Extra info is... |
188 // ... for other types, either a description of how to manage the extension | 170 // ... for other types, either a description of how to manage the extension |
189 // or a link to configure the keybinding shortcut (if one exists). | 171 // or a link to configure the keybinding shortcut (if one exists). |
190 // Extra info can include a promo for signing into sync. | 172 // Extra info can include a promo for signing into sync. |
191 | 173 |
192 // First figure out the keybinding situation. | 174 const Extension* extension = bubble.extension(); |
193 extensions::Command command; | |
194 bool has_keybinding = GetKeybinding(&command); | |
195 base::string16 key; // Keyboard shortcut or keyword to display in bubble. | |
196 | |
197 if (extensions::sync_helper::IsSyncableExtension(extension) && | 175 if (extensions::sync_helper::IsSyncableExtension(extension) && |
198 SyncPromoUI::ShouldShowSyncPromo(browser->profile())) | 176 SyncPromoUI::ShouldShowSyncPromo(browser->profile())) |
199 flavors_ |= SIGN_IN_PROMO; | 177 flavors_ |= SIGN_IN_PROMO; |
200 | 178 |
201 // Determine the bubble flavor we want, based on the extension type. | 179 // Determine the bubble flavor we want, based on the extension type. |
202 switch (type_) { | 180 switch (bubble.type()) { |
203 case ExtensionInstalledBubble::BROWSER_ACTION: | 181 case ExtensionInstalledBubble::BROWSER_ACTION: |
204 case ExtensionInstalledBubble::PAGE_ACTION: { | 182 case ExtensionInstalledBubble::PAGE_ACTION: |
205 flavors_ |= HOW_TO_USE; | 183 flavors_ |= HOW_TO_USE; |
206 if (has_keybinding) { | 184 if (bubble.has_command_keybinding()) { |
207 flavors_ |= SHOW_KEYBINDING; | 185 flavors_ |= SHOW_KEYBINDING; |
208 key = command.accelerator().GetShortcutText(); | |
209 } else { | 186 } else { |
210 // The How-To-Use text makes the bubble seem a little crowded when the | 187 // The How-To-Use text makes the bubble seem a little crowded when the |
211 // extension has a keybinding, so the How-To-Manage text is not shown | 188 // extension has a keybinding, so the How-To-Manage text is not shown |
212 // in those cases. | 189 // in those cases. |
213 flavors_ |= HOW_TO_MANAGE; | 190 flavors_ |= HOW_TO_MANAGE; |
214 } | 191 } |
215 break; | 192 break; |
216 } | 193 case ExtensionInstalledBubble::OMNIBOX_KEYWORD: |
217 case ExtensionInstalledBubble::OMNIBOX_KEYWORD: { | |
218 flavors_ |= HOW_TO_USE | HOW_TO_MANAGE; | 194 flavors_ |= HOW_TO_USE | HOW_TO_MANAGE; |
219 key = base::UTF8ToUTF16(extensions::OmniboxInfo::GetKeyword(extension)); | |
220 break; | 195 break; |
221 } | 196 case ExtensionInstalledBubble::GENERIC: |
222 case ExtensionInstalledBubble::GENERIC: { | |
223 break; | 197 break; |
224 } | 198 default: |
225 default: { | |
226 // When adding a new bubble type, the flavor needs to be set. | 199 // When adding a new bubble type, the flavor needs to be set. |
227 static_assert(ExtensionInstalledBubble::GENERIC == 3, | 200 static_assert(ExtensionInstalledBubble::GENERIC == 3, |
228 "kBubbleType enum has changed, this switch statement must " | 201 "kBubbleType enum has changed, this switch statement must " |
229 "be updateed"); | 202 "be updateed"); |
230 break; | 203 break; |
231 } | |
232 } | 204 } |
233 | 205 |
234 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 206 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
235 const gfx::FontList& font_list = | 207 const gfx::FontList& font_list = |
236 rb.GetFontList(ui::ResourceBundle::BaseFont); | 208 rb.GetFontList(ui::ResourceBundle::BaseFont); |
237 | 209 |
| 210 const SkBitmap& icon = bubble.icon(); |
238 // Add the icon (for all flavors). | 211 // Add the icon (for all flavors). |
239 // Scale down to 43x43, but allow smaller icons (don't scale up). | 212 // Scale down to 43x43, but allow smaller icons (don't scale up). |
240 gfx::Size size(icon->width(), icon->height()); | 213 gfx::Size size(icon.width(), icon.height()); |
241 if (size.width() > kIconSize || size.height() > kIconSize) | 214 if (size.width() > kIconSize || size.height() > kIconSize) |
242 size = gfx::Size(kIconSize, kIconSize); | 215 size = gfx::Size(kIconSize, kIconSize); |
243 icon_ = new views::ImageView(); | 216 icon_ = new views::ImageView(); |
244 icon_->SetImageSize(size); | 217 icon_->SetImageSize(size); |
245 icon_->SetImage(gfx::ImageSkia::CreateFrom1xBitmap(*icon)); | 218 icon_->SetImage(gfx::ImageSkia::CreateFrom1xBitmap(icon)); |
246 AddChildView(icon_); | 219 AddChildView(icon_); |
247 | 220 |
248 // Add the heading (for all flavors). | 221 // Add the heading (for all flavors). |
249 base::string16 extension_name = base::UTF8ToUTF16(extension->name()); | 222 base::string16 extension_name = base::UTF8ToUTF16(extension->name()); |
250 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 223 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
251 heading_ = new views::Label(l10n_util::GetStringFUTF16( | 224 heading_ = new views::Label(l10n_util::GetStringFUTF16( |
252 IDS_EXTENSION_INSTALLED_HEADING, extension_name)); | 225 IDS_EXTENSION_INSTALLED_HEADING, extension_name)); |
253 heading_->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont)); | 226 heading_->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont)); |
254 heading_->SetMultiLine(true); | 227 heading_->SetMultiLine(true); |
255 heading_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 228 heading_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
256 AddChildView(heading_); | 229 AddChildView(heading_); |
257 | 230 |
258 if (flavors_ & HOW_TO_USE) { | 231 if (flavors_ & HOW_TO_USE) { |
259 how_to_use_ = new views::Label(GetHowToUseDescription(key)); | 232 how_to_use_ = new views::Label(bubble.GetHowToUseDescription()); |
260 how_to_use_->SetFontList(font_list); | 233 how_to_use_->SetFontList(font_list); |
261 how_to_use_->SetMultiLine(true); | 234 how_to_use_->SetMultiLine(true); |
262 how_to_use_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 235 how_to_use_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
263 AddChildView(how_to_use_); | 236 AddChildView(how_to_use_); |
264 } | 237 } |
265 | 238 |
266 if (flavors_ & SHOW_KEYBINDING) { | 239 if (flavors_ & SHOW_KEYBINDING) { |
267 manage_shortcut_ = new views::Link( | 240 manage_shortcut_ = new views::Link( |
268 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS)); | 241 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS)); |
269 manage_shortcut_->set_listener(this); | 242 manage_shortcut_->set_listener(this); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 292 |
320 DCHECK_EQ(manage_shortcut_, source); | 293 DCHECK_EQ(manage_shortcut_, source); |
321 | 294 |
322 std::string configure_url = chrome::kChromeUIExtensionsURL; | 295 std::string configure_url = chrome::kChromeUIExtensionsURL; |
323 configure_url += chrome::kExtensionConfigureCommandsSubPage; | 296 configure_url += chrome::kExtensionConfigureCommandsSubPage; |
324 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( | 297 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
325 browser_, GURL(configure_url))); | 298 browser_, GURL(configure_url))); |
326 chrome::Navigate(¶ms); | 299 chrome::Navigate(¶ms); |
327 } | 300 } |
328 | 301 |
329 bool InstalledBubbleContent::GetKeybinding(extensions::Command* command) { | |
330 extensions::CommandService* command_service = | |
331 extensions::CommandService::Get(browser_->profile()); | |
332 if (type_ == ExtensionInstalledBubble::BROWSER_ACTION) { | |
333 return command_service->GetBrowserActionCommand( | |
334 extension_id_, | |
335 extensions::CommandService::ACTIVE, | |
336 command, | |
337 NULL); | |
338 } else if (type_ == ExtensionInstalledBubble::PAGE_ACTION) { | |
339 return command_service->GetPageActionCommand( | |
340 extension_id_, | |
341 extensions::CommandService::ACTIVE, | |
342 command, | |
343 NULL); | |
344 } else { | |
345 return false; | |
346 } | |
347 } | |
348 | |
349 base::string16 InstalledBubbleContent::GetHowToUseDescription( | |
350 const base::string16& key) { | |
351 switch (type_) { | |
352 case ExtensionInstalledBubble::BROWSER_ACTION: | |
353 if (!key.empty()) { | |
354 return l10n_util::GetStringFUTF16( | |
355 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, key); | |
356 } else { | |
357 return l10n_util::GetStringUTF16( | |
358 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO); | |
359 } | |
360 break; | |
361 case ExtensionInstalledBubble::PAGE_ACTION: | |
362 if (!key.empty()) { | |
363 return l10n_util::GetStringFUTF16( | |
364 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT, key); | |
365 } else { | |
366 return l10n_util::GetStringUTF16( | |
367 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO); | |
368 } | |
369 break; | |
370 case ExtensionInstalledBubble::OMNIBOX_KEYWORD: | |
371 return l10n_util::GetStringFUTF16( | |
372 IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO, key); | |
373 break; | |
374 default: | |
375 NOTREACHED(); | |
376 break; | |
377 } | |
378 return base::string16(); | |
379 } | |
380 | |
381 int InstalledBubbleContent::LayoutSigninPromo(int offset_x, int offset_y) { | 302 int InstalledBubbleContent::LayoutSigninPromo(int offset_x, int offset_y) { |
382 sign_in_promo_lines_.clear(); | 303 sign_in_promo_lines_.clear(); |
383 int height = 0; | 304 int height = 0; |
384 gfx::Rect contents_area = GetContentsBounds(); | 305 gfx::Rect contents_area = GetContentsBounds(); |
385 if (contents_area.IsEmpty()) | 306 if (contents_area.IsEmpty()) |
386 return height; | 307 return height; |
387 contents_area.set_width(kRightColumnWidth); | 308 contents_area.set_width(kRightColumnWidth); |
388 | 309 |
389 base::string16 full_text = signin_promo_link_text_ + signin_promo_text_; | 310 base::string16 full_text = signin_promo_link_text_ + signin_promo_text_; |
390 | 311 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 503 |
583 // Default case. | 504 // Default case. |
584 if (reference_view == NULL) | 505 if (reference_view == NULL) |
585 reference_view = browser_view->GetToolbarView()->app_menu(); | 506 reference_view = browser_view->GetToolbarView()->app_menu(); |
586 SetAnchorView(reference_view); | 507 SetAnchorView(reference_view); |
587 | 508 |
588 set_arrow(bubble_.type() == bubble_.OMNIBOX_KEYWORD ? | 509 set_arrow(bubble_.type() == bubble_.OMNIBOX_KEYWORD ? |
589 views::BubbleBorder::TOP_LEFT : | 510 views::BubbleBorder::TOP_LEFT : |
590 views::BubbleBorder::TOP_RIGHT); | 511 views::BubbleBorder::TOP_RIGHT); |
591 SetLayoutManager(new views::FillLayout()); | 512 SetLayoutManager(new views::FillLayout()); |
592 AddChildView(new InstalledBubbleContent( | 513 AddChildView(new InstalledBubbleContent(bubble_, bubble_.browser())); |
593 bubble_.browser(), bubble_.extension(), bubble_.type(), | |
594 &bubble_.icon())); | |
595 | 514 |
596 views::BubbleDelegateView::CreateBubble(this)->Show(); | 515 views::BubbleDelegateView::CreateBubble(this)->Show(); |
597 | 516 |
598 // The bubble widget is now the parent and owner of |this| and takes care of | 517 // The bubble widget is now the parent and owner of |this| and takes care of |
599 // deletion when the bubble or browser go away. | 518 // deletion when the bubble or browser go away. |
600 bubble_.IgnoreBrowserClosing(); | 519 bubble_.IgnoreBrowserClosing(); |
601 | 520 |
602 return true; | 521 return true; |
603 } | 522 } |
604 | 523 |
(...skipping 14 matching lines...) Expand all Loading... |
619 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION && | 538 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION && |
620 !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { | 539 !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { |
621 BrowserView* browser_view = | 540 BrowserView* browser_view = |
622 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); | 541 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); |
623 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 542 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
624 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> | 543 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> |
625 GetPageAction(*bubble_.extension()), | 544 GetPageAction(*bubble_.extension()), |
626 false); // preview_enabled | 545 false); // preview_enabled |
627 } | 546 } |
628 } | 547 } |
OLD | NEW |