| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/user_metrics_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 if (controller_->options() & ExtensionInstalledBubble::HOW_TO_MANAGE) { | 253 if (controller_->options() & ExtensionInstalledBubble::HOW_TO_MANAGE) { |
| 254 AddChildView(CreateLabel( | 254 AddChildView(CreateLabel( |
| 255 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO))); | 255 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO))); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 void ExtensionInstalledBubbleView::OnSignInLinkClicked() { | 259 void ExtensionInstalledBubbleView::OnSignInLinkClicked() { |
| 260 chrome::ShowBrowserSignin( | 260 chrome::ShowBrowserSignin( |
| 261 browser(), | 261 browser(), |
| 262 signin_metrics::AccessPoint::ACCESS_POINT_EXTENSION_INSTALL_BUBBLE); | 262 signin_metrics::AccessPoint::ACCESS_POINT_EXTENSION_INSTALL_BUBBLE); |
| 263 CloseBubble(); | 263 // Showing the sign-in UI will cause the bubble to close. |
| 264 CHECK(GetWidget()->IsClosed()); |
| 264 } | 265 } |
| 265 | 266 |
| 266 void ExtensionInstalledBubbleView::LinkClicked(views::Link* source, | 267 void ExtensionInstalledBubbleView::LinkClicked(views::Link* source, |
| 267 int event_flags) { | 268 int event_flags) { |
| 268 DCHECK_EQ(manage_shortcut_, source); | 269 DCHECK_EQ(manage_shortcut_, source); |
| 269 | 270 |
| 270 std::string configure_url = chrome::kChromeUIExtensionsURL; | 271 std::string configure_url = chrome::kChromeUIExtensionsURL; |
| 271 configure_url += chrome::kExtensionConfigureCommandsSubPage; | 272 configure_url += chrome::kExtensionConfigureCommandsSubPage; |
| 272 chrome::NavigateParams params( | 273 chrome::NavigateParams params( |
| 273 chrome::GetSingletonTabNavigateParams(browser(), GURL(configure_url))); | 274 chrome::GetSingletonTabNavigateParams(browser(), GURL(configure_url))); |
| 274 chrome::Navigate(¶ms); | 275 chrome::Navigate(¶ms); |
| 275 CloseBubble(); | 276 // Navigating will cause the bubble to close. |
| 277 CHECK(GetWidget()->IsClosed()); |
| 276 } | 278 } |
| 277 | 279 |
| 278 gfx::Size ExtensionInstalledBubbleView::GetIconSize() const { | 280 gfx::Size ExtensionInstalledBubbleView::GetIconSize() const { |
| 279 const SkBitmap& bitmap = controller_->icon(); | 281 const SkBitmap& bitmap = controller_->icon(); |
| 280 // Scale down to 43x43, but allow smaller icons (don't scale up). | 282 // Scale down to 43x43, but allow smaller icons (don't scale up). |
| 281 gfx::Size size(bitmap.width(), bitmap.height()); | 283 gfx::Size size(bitmap.width(), bitmap.height()); |
| 282 return size.width() > kIconSize || size.height() > kIconSize | 284 return size.width() > kIconSize || size.height() > kIconSize |
| 283 ? gfx::Size(kIconSize, kIconSize) | 285 ? gfx::Size(kIconSize, kIconSize) |
| 284 : size; | 286 : size; |
| 285 } | 287 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 ->browser_actions(); | 355 ->browser_actions(); |
| 354 return !container->animating(); | 356 return !container->animating(); |
| 355 } | 357 } |
| 356 return true; | 358 return true; |
| 357 } | 359 } |
| 358 | 360 |
| 359 // Implemented here to create the platform specific instance of the BubbleUi. | 361 // Implemented here to create the platform specific instance of the BubbleUi. |
| 360 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { | 362 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { |
| 361 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); | 363 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); |
| 362 } | 364 } |
| OLD | NEW |