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 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/extensions/extension_install_ui.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/views/browser_actions_container.h" | 16 #include "chrome/browser/ui/views/browser_actions_container.h" |
16 #include "chrome/browser/ui/views/frame/browser_view.h" | 17 #include "chrome/browser/ui/views/frame/browser_view.h" |
17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 18 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 19 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
18 #include "chrome/browser/ui/views/toolbar_view.h" | 20 #include "chrome/browser/ui/views/toolbar_view.h" |
19 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
21 #include "chrome/common/extensions/extension_action.h" | 23 #include "chrome/common/extensions/extension_action.h" |
22 #include "content/common/notification_details.h" | 24 #include "content/common/notification_details.h" |
23 #include "content/common/notification_source.h" | 25 #include "content/common/notification_source.h" |
24 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
25 #include "grit/theme_resources_standard.h" | 27 #include "grit/theme_resources_standard.h" |
26 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
28 #include "views/controls/button/image_button.h" | 30 #include "views/controls/button/image_button.h" |
29 #include "views/controls/image_view.h" | 31 #include "views/controls/image_view.h" |
30 #include "views/controls/label.h" | 32 #include "views/controls/label.h" |
| 33 #include "views/controls/link.h" |
| 34 #include "views/controls/link_listener.h" |
31 #include "views/layout/layout_constants.h" | 35 #include "views/layout/layout_constants.h" |
32 #include "views/view.h" | 36 #include "views/view.h" |
33 | 37 |
34 namespace { | 38 namespace { |
35 | 39 |
36 const int kIconSize = 43; | 40 const int kIconSize = 43; |
37 | 41 |
38 const int kRightColumnWidth = 285; | 42 const int kRightColumnWidth = 285; |
39 | 43 |
40 // The Bubble uses a BubbleBorder which adds about 6 pixels of whitespace | 44 // The Bubble uses a BubbleBorder which adds about 6 pixels of whitespace |
(...skipping 30 matching lines...) Expand all Loading... |
71 Profile* profile) { | 75 Profile* profile) { |
72 ExtensionInstalledBubble::Show(extension, browser, icon); | 76 ExtensionInstalledBubble::Show(extension, browser, icon); |
73 } | 77 } |
74 | 78 |
75 } // namespace browser | 79 } // namespace browser |
76 | 80 |
77 // InstalledBubbleContent is the content view which is placed in the | 81 // InstalledBubbleContent is the content view which is placed in the |
78 // ExtensionInstalledBubble. It displays the install icon and explanatory | 82 // ExtensionInstalledBubble. It displays the install icon and explanatory |
79 // text about the installed extension. | 83 // text about the installed extension. |
80 class InstalledBubbleContent : public views::View, | 84 class InstalledBubbleContent : public views::View, |
81 public views::ButtonListener { | 85 public views::ButtonListener, |
| 86 public views::LinkListener { |
82 public: | 87 public: |
83 InstalledBubbleContent(const Extension* extension, | 88 InstalledBubbleContent(Browser* browser, |
| 89 const Extension* extension, |
84 ExtensionInstalledBubble::BubbleType type, | 90 ExtensionInstalledBubble::BubbleType type, |
85 SkBitmap* icon) | 91 SkBitmap* icon) |
86 : bubble_(NULL), | 92 : browser_(browser), |
| 93 extension_id_(extension->id()), |
| 94 bubble_(NULL), |
87 type_(type), | 95 type_(type), |
88 info_(NULL) { | 96 info_(NULL) { |
89 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 97 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
90 const gfx::Font& font = rb.GetFont(ResourceBundle::BaseFont); | 98 const gfx::Font& font = rb.GetFont(ResourceBundle::BaseFont); |
91 | 99 |
92 // Scale down to 43x43, but allow smaller icons (don't scale up). | 100 // Scale down to 43x43, but allow smaller icons (don't scale up). |
93 gfx::Size size(icon->width(), icon->height()); | 101 gfx::Size size(icon->width(), icon->height()); |
94 if (size.width() > kIconSize || size.height() > kIconSize) | 102 if (size.width() > kIconSize || size.height() > kIconSize) |
95 size = gfx::Size(kIconSize, kIconSize); | 103 size = gfx::Size(kIconSize, kIconSize); |
96 icon_ = new views::ImageView(); | 104 icon_ = new views::ImageView(); |
97 icon_->SetImageSize(size); | 105 icon_->SetImageSize(size); |
98 icon_->SetImage(*icon); | 106 icon_->SetImage(*icon); |
99 AddChildView(icon_); | 107 AddChildView(icon_); |
100 | 108 |
101 string16 extension_name = UTF8ToUTF16(extension->name()); | 109 string16 extension_name = UTF8ToUTF16(extension->name()); |
102 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 110 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
103 heading_ = new views::Label(UTF16ToWide( | 111 heading_ = new views::Label(UTF16ToWide( |
104 l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, | 112 l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, |
105 extension_name))); | 113 extension_name))); |
106 heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); | 114 heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); |
107 heading_->SetMultiLine(true); | 115 heading_->SetMultiLine(true); |
108 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 116 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
109 AddChildView(heading_); | 117 AddChildView(heading_); |
110 | 118 |
111 if (type_ == ExtensionInstalledBubble::PAGE_ACTION) { | 119 switch (type_) { |
112 info_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( | 120 case ExtensionInstalledBubble::PAGE_ACTION: { |
113 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO))); | 121 info_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( |
114 info_->SetFont(font); | 122 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO))); |
115 info_->SetMultiLine(true); | 123 info_->SetFont(font); |
116 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 124 info_->SetMultiLine(true); |
117 AddChildView(info_); | 125 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 126 AddChildView(info_); |
| 127 break; |
| 128 } |
| 129 case ExtensionInstalledBubble::OMNIBOX_KEYWORD: { |
| 130 info_ = new views::Label(UTF16ToWide(l10n_util::GetStringFUTF16( |
| 131 IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO, |
| 132 UTF8ToUTF16(extension->omnibox_keyword())))); |
| 133 info_->SetFont(font); |
| 134 info_->SetMultiLine(true); |
| 135 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 136 AddChildView(info_); |
| 137 break; |
| 138 } |
| 139 case ExtensionInstalledBubble::APP: { |
| 140 views::Link* link = new views::Link(UTF16ToWide( |
| 141 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_APP_INFO))); |
| 142 link->set_listener(this); |
| 143 manage_ = link; |
| 144 manage_->SetFont(font); |
| 145 manage_->SetMultiLine(true); |
| 146 manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 147 AddChildView(manage_); |
| 148 break; |
| 149 } |
| 150 default: |
| 151 break; |
118 } | 152 } |
119 | 153 |
120 if (type_ == ExtensionInstalledBubble::OMNIBOX_KEYWORD) { | 154 if (type_ != ExtensionInstalledBubble::APP) { |
121 info_ = new views::Label(UTF16ToWide(l10n_util::GetStringFUTF16( | 155 manage_ = new views::Label(UTF16ToWide( |
122 IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO, | 156 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO))); |
123 UTF8ToUTF16(extension->omnibox_keyword())))); | 157 manage_->SetFont(font); |
124 info_->SetFont(font); | 158 manage_->SetMultiLine(true); |
125 info_->SetMultiLine(true); | 159 manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
126 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 160 AddChildView(manage_); |
127 AddChildView(info_); | |
128 } | 161 } |
129 | 162 |
130 manage_ = new views::Label(UTF16ToWide( | |
131 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO))); | |
132 manage_->SetFont(font); | |
133 manage_->SetMultiLine(true); | |
134 manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | |
135 AddChildView(manage_); | |
136 | |
137 close_button_ = new views::ImageButton(this); | 163 close_button_ = new views::ImageButton(this); |
138 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 164 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
139 rb.GetBitmapNamed(IDR_CLOSE_BAR)); | 165 rb.GetBitmapNamed(IDR_CLOSE_BAR)); |
140 close_button_->SetImage(views::CustomButton::BS_HOT, | 166 close_button_->SetImage(views::CustomButton::BS_HOT, |
141 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); | 167 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); |
142 close_button_->SetImage(views::CustomButton::BS_PUSHED, | 168 close_button_->SetImage(views::CustomButton::BS_PUSHED, |
143 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); | 169 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); |
144 AddChildView(close_button_); | 170 AddChildView(close_button_); |
145 } | 171 } |
146 | 172 |
147 void set_bubble(Bubble* bubble) { bubble_ = bubble; } | 173 void set_bubble(Bubble* bubble) { bubble_ = bubble; } |
148 | 174 |
149 virtual void ButtonPressed( | 175 virtual void ButtonPressed( |
150 views::Button* sender, | 176 views::Button* sender, |
151 const views::Event& event) { | 177 const views::Event& event) { |
152 if (sender == close_button_) { | 178 if (sender == close_button_) { |
153 bubble_->set_fade_away_on_close(true); | 179 bubble_->set_fade_away_on_close(true); |
154 GetWidget()->Close(); | 180 GetWidget()->Close(); |
155 } else { | 181 } else { |
156 NOTREACHED() << "Unknown view"; | 182 NOTREACHED() << "Unknown view"; |
157 } | 183 } |
158 } | 184 } |
159 | 185 |
| 186 // Implements the views::LinkListener interface. |
| 187 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE { |
| 188 GetWidget()->Close(); |
| 189 ExtensionInstallUI::OpenAppInstalledNTP(browser_, extension_id_); |
| 190 } |
| 191 |
160 private: | 192 private: |
161 virtual gfx::Size GetPreferredSize() { | 193 virtual gfx::Size GetPreferredSize() { |
162 int width = kHorizOuterMargin; | 194 int width = kHorizOuterMargin; |
163 width += kIconSize; | 195 width += kIconSize; |
164 width += views::kPanelHorizMargin; | 196 width += views::kPanelHorizMargin; |
165 width += kRightColumnWidth; | 197 width += kRightColumnWidth; |
166 width += 2 * views::kPanelHorizMargin; | 198 width += 2 * views::kPanelHorizMargin; |
167 width += kHorizOuterMargin; | 199 width += kHorizOuterMargin; |
168 | 200 |
169 int height = kVertOuterMargin; | 201 int height = kVertOuterMargin; |
170 height += heading_->GetHeightForWidth(kRightColumnWidth); | 202 height += heading_->GetHeightForWidth(kRightColumnWidth); |
171 height += kVertInnerMargin; | 203 height += kVertInnerMargin; |
172 if (type_ == ExtensionInstalledBubble::PAGE_ACTION || | 204 if (info_) { |
173 type_ == ExtensionInstalledBubble::OMNIBOX_KEYWORD) { | |
174 height += info_->GetHeightForWidth(kRightColumnWidth); | 205 height += info_->GetHeightForWidth(kRightColumnWidth); |
175 height += kVertInnerMargin; | 206 height += kVertInnerMargin; |
176 } | 207 } |
177 height += manage_->GetHeightForWidth(kRightColumnWidth); | 208 height += manage_->GetHeightForWidth(kRightColumnWidth); |
178 height += kVertOuterMargin; | 209 height += kVertOuterMargin; |
179 | 210 |
180 return gfx::Size(width, std::max(height, kIconSize + 2 * kVertOuterMargin)); | 211 return gfx::Size(width, std::max(height, kIconSize + 2 * kVertOuterMargin)); |
181 } | 212 } |
182 | 213 |
183 virtual void Layout() { | 214 virtual void Layout() { |
184 int x = kHorizOuterMargin; | 215 int x = kHorizOuterMargin; |
185 int y = kVertOuterMargin; | 216 int y = kVertOuterMargin; |
186 | 217 |
187 icon_->SetBounds(x, y, kIconSize, kIconSize); | 218 icon_->SetBounds(x, y, kIconSize, kIconSize); |
188 x += kIconSize; | 219 x += kIconSize; |
189 x += views::kPanelHorizMargin; | 220 x += views::kPanelHorizMargin; |
190 | 221 |
191 y += kRightcolumnVerticalShift; | 222 y += kRightcolumnVerticalShift; |
192 heading_->SizeToFit(kRightColumnWidth); | 223 heading_->SizeToFit(kRightColumnWidth); |
193 heading_->SetX(x); | 224 heading_->SetX(x); |
194 heading_->SetY(y); | 225 heading_->SetY(y); |
195 y += heading_->height(); | 226 y += heading_->height(); |
196 y += kVertInnerMargin; | 227 y += kVertInnerMargin; |
197 | 228 |
198 if (type_ == ExtensionInstalledBubble::PAGE_ACTION || | 229 if (info_) { |
199 type_ == ExtensionInstalledBubble::OMNIBOX_KEYWORD) { | |
200 info_->SizeToFit(kRightColumnWidth); | 230 info_->SizeToFit(kRightColumnWidth); |
201 info_->SetX(x); | 231 info_->SetX(x); |
202 info_->SetY(y); | 232 info_->SetY(y); |
203 y += info_->height(); | 233 y += info_->height(); |
204 y += kVertInnerMargin; | 234 y += kVertInnerMargin; |
205 } | 235 } |
206 | 236 |
207 manage_->SizeToFit(kRightColumnWidth); | 237 manage_->SizeToFit(kRightColumnWidth); |
208 manage_->SetX(x); | 238 manage_->SetX(x); |
209 manage_->SetY(y); | 239 manage_->SetY(y); |
210 y += manage_->height(); | 240 y += manage_->height(); |
211 y += kVertInnerMargin; | 241 y += kVertInnerMargin; |
212 | 242 |
213 gfx::Size sz; | 243 gfx::Size sz; |
214 x += kRightColumnWidth + 2 * views::kPanelHorizMargin + kHorizOuterMargin - | 244 x += kRightColumnWidth + 2 * views::kPanelHorizMargin + kHorizOuterMargin - |
215 close_button_->GetPreferredSize().width(); | 245 close_button_->GetPreferredSize().width(); |
216 y = kVertOuterMargin; | 246 y = kVertOuterMargin; |
217 sz = close_button_->GetPreferredSize(); | 247 sz = close_button_->GetPreferredSize(); |
218 // x-1 & y-1 is just slop to get the close button visually aligned with the | 248 // x-1 & y-1 is just slop to get the close button visually aligned with the |
219 // title text and bubble arrow. | 249 // title text and bubble arrow. |
220 close_button_->SetBounds(x - 1, y - 1, sz.width(), sz.height()); | 250 close_button_->SetBounds(x - 1, y - 1, sz.width(), sz.height()); |
221 } | 251 } |
222 | 252 |
| 253 // The browser we're associated with. |
| 254 Browser* browser_; |
| 255 |
| 256 // The id of the extension just installed. |
| 257 const std::string extension_id_; |
| 258 |
223 // The Bubble showing us. | 259 // The Bubble showing us. |
224 Bubble* bubble_; | 260 Bubble* bubble_; |
225 | 261 |
226 ExtensionInstalledBubble::BubbleType type_; | 262 ExtensionInstalledBubble::BubbleType type_; |
227 views::ImageView* icon_; | 263 views::ImageView* icon_; |
228 views::Label* heading_; | 264 views::Label* heading_; |
229 views::Label* info_; | 265 views::Label* info_; |
230 views::Label* manage_; | 266 views::Label* manage_; |
231 views::ImageButton* close_button_; | 267 views::ImageButton* close_button_; |
232 | 268 |
233 DISALLOW_COPY_AND_ASSIGN(InstalledBubbleContent); | 269 DISALLOW_COPY_AND_ASSIGN(InstalledBubbleContent); |
234 }; | 270 }; |
235 | 271 |
236 void ExtensionInstalledBubble::Show(const Extension* extension, | 272 void ExtensionInstalledBubble::Show(const Extension* extension, |
237 Browser *browser, | 273 Browser *browser, |
238 const SkBitmap& icon) { | 274 const SkBitmap& icon) { |
239 new ExtensionInstalledBubble(extension, browser, icon); | 275 new ExtensionInstalledBubble(extension, browser, icon); |
240 } | 276 } |
241 | 277 |
242 ExtensionInstalledBubble::ExtensionInstalledBubble(const Extension* extension, | 278 ExtensionInstalledBubble::ExtensionInstalledBubble(const Extension* extension, |
243 Browser *browser, | 279 Browser *browser, |
244 const SkBitmap& icon) | 280 const SkBitmap& icon) |
245 : extension_(extension), | 281 : extension_(extension), |
246 browser_(browser), | 282 browser_(browser), |
247 icon_(icon), | 283 icon_(icon), |
248 animation_wait_retries_(0) { | 284 animation_wait_retries_(0) { |
249 AddRef(); // Balanced in BubbleClosing. | 285 AddRef(); // Balanced in BubbleClosing. |
250 | 286 |
251 if (!extension_->omnibox_keyword().empty()) { | 287 if (extension->is_app()) { |
| 288 type_ = APP; |
| 289 } else if (!extension_->omnibox_keyword().empty()) { |
252 type_ = OMNIBOX_KEYWORD; | 290 type_ = OMNIBOX_KEYWORD; |
253 } else if (extension_->browser_action()) { | 291 } else if (extension_->browser_action()) { |
254 type_ = BROWSER_ACTION; | 292 type_ = BROWSER_ACTION; |
255 } else if (extension->page_action() && | 293 } else if (extension->page_action() && |
256 !extension->page_action()->default_icon_path().empty()) { | 294 !extension->page_action()->default_icon_path().empty()) { |
257 type_ = PAGE_ACTION; | 295 type_ = PAGE_ACTION; |
258 } else { | 296 } else { |
259 type_ = GENERIC; | 297 type_ = GENERIC; |
260 } | 298 } |
261 | 299 |
(...skipping 29 matching lines...) Expand all Loading... |
291 } else { | 329 } else { |
292 NOTREACHED() << L"Received unexpected notification"; | 330 NOTREACHED() << L"Received unexpected notification"; |
293 } | 331 } |
294 } | 332 } |
295 | 333 |
296 void ExtensionInstalledBubble::ShowInternal() { | 334 void ExtensionInstalledBubble::ShowInternal() { |
297 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( | 335 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( |
298 browser_->window()->GetNativeHandle()); | 336 browser_->window()->GetNativeHandle()); |
299 | 337 |
300 const views::View* reference_view = NULL; | 338 const views::View* reference_view = NULL; |
301 if (type_ == BROWSER_ACTION) { | 339 if (type_ == APP) { |
| 340 if (browser_view->IsTabStripVisible()) { |
| 341 AbstractTabStripView* tabstrip = browser_view->tabstrip(); |
| 342 views::View* ntp_button = tabstrip->GetNewTabButton(); |
| 343 if (ntp_button && ntp_button->IsVisibleInRootView()) { |
| 344 reference_view = ntp_button; |
| 345 } else { |
| 346 // Just have the bubble point at the tab strip. |
| 347 reference_view = tabstrip; |
| 348 } |
| 349 } |
| 350 } else if (type_ == BROWSER_ACTION) { |
302 BrowserActionsContainer* container = | 351 BrowserActionsContainer* container = |
303 browser_view->GetToolbarView()->browser_actions(); | 352 browser_view->GetToolbarView()->browser_actions(); |
304 if (container->animating() && | 353 if (container->animating() && |
305 animation_wait_retries_++ < kAnimationWaitMaxRetry) { | 354 animation_wait_retries_++ < kAnimationWaitMaxRetry) { |
306 // We don't know where the view will be until the container has stopped | 355 // We don't know where the view will be until the container has stopped |
307 // animating, so check back in a little while. | 356 // animating, so check back in a little while. |
308 MessageLoopForUI::current()->PostDelayedTask( | 357 MessageLoopForUI::current()->PostDelayedTask( |
309 FROM_HERE, NewRunnableMethod(this, | 358 FROM_HERE, NewRunnableMethod(this, |
310 &ExtensionInstalledBubble::ShowInternal), kAnimationWaitTime); | 359 &ExtensionInstalledBubble::ShowInternal), kAnimationWaitTime); |
311 return; | 360 return; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 394 |
346 // For omnibox keyword bubbles, move the arrow to point to the left edge | 395 // For omnibox keyword bubbles, move the arrow to point to the left edge |
347 // of the omnibox, just to the right of the icon. | 396 // of the omnibox, just to the right of the icon. |
348 if (type_ == OMNIBOX_KEYWORD) { | 397 if (type_ == OMNIBOX_KEYWORD) { |
349 bounds.set_origin( | 398 bounds.set_origin( |
350 browser_view->GetLocationBarView()->GetLocationEntryOrigin()); | 399 browser_view->GetLocationBarView()->GetLocationEntryOrigin()); |
351 bounds.set_width(0); | 400 bounds.set_width(0); |
352 arrow_location = BubbleBorder::TOP_LEFT; | 401 arrow_location = BubbleBorder::TOP_LEFT; |
353 } | 402 } |
354 | 403 |
355 bubble_content_ = new InstalledBubbleContent(extension_, type_, &icon_); | 404 bubble_content_ = new InstalledBubbleContent( |
| 405 browser_, extension_, type_, &icon_); |
356 Bubble* bubble = Bubble::Show(browser_view->GetWidget(), bounds, | 406 Bubble* bubble = Bubble::Show(browser_view->GetWidget(), bounds, |
357 arrow_location, bubble_content_, this); | 407 arrow_location, bubble_content_, this); |
358 bubble_content_->set_bubble(bubble); | 408 bubble_content_->set_bubble(bubble); |
359 } | 409 } |
360 | 410 |
361 // BubbleDelegate | 411 // BubbleDelegate |
362 void ExtensionInstalledBubble::BubbleClosing(Bubble* bubble, | 412 void ExtensionInstalledBubble::BubbleClosing(Bubble* bubble, |
363 bool closed_by_escape) { | 413 bool closed_by_escape) { |
364 if (extension_ && type_ == PAGE_ACTION) { | 414 if (extension_ && type_ == PAGE_ACTION) { |
365 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( | 415 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( |
366 browser_->window()->GetNativeHandle()); | 416 browser_->window()->GetNativeHandle()); |
367 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 417 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
368 extension_->page_action(), | 418 extension_->page_action(), |
369 false); // preview_enabled | 419 false); // preview_enabled |
370 } | 420 } |
371 | 421 |
372 Release(); // Balanced in ctor. | 422 Release(); // Balanced in ctor. |
373 } | 423 } |
374 | 424 |
375 bool ExtensionInstalledBubble::CloseOnEscape() { | 425 bool ExtensionInstalledBubble::CloseOnEscape() { |
376 return true; | 426 return true; |
377 } | 427 } |
378 | 428 |
379 bool ExtensionInstalledBubble::FadeInOnShow() { | 429 bool ExtensionInstalledBubble::FadeInOnShow() { |
380 return true; | 430 return true; |
381 } | 431 } |
OLD | NEW |