Chromium Code Reviews| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 if (controller_->options() & ExtensionInstalledBubble::HOW_TO_MANAGE) { | 254 if (controller_->options() & ExtensionInstalledBubble::HOW_TO_MANAGE) { |
| 255 AddChildView(CreateLabel( | 255 AddChildView(CreateLabel( |
| 256 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO))); | 256 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO))); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 void ExtensionInstalledBubbleView::OnSignInLinkClicked() { | 260 void ExtensionInstalledBubbleView::OnSignInLinkClicked() { |
| 261 chrome::ShowBrowserSignin( | 261 chrome::ShowBrowserSignin( |
| 262 browser(), | 262 browser(), |
| 263 signin_metrics::AccessPoint::ACCESS_POINT_EXTENSION_INSTALL_BUBBLE); | 263 signin_metrics::AccessPoint::ACCESS_POINT_EXTENSION_INSTALL_BUBBLE); |
| 264 CloseBubble(); | 264 // Showing the sign-in UI will cause the bubble to close. |
| 265 CHECK(GetWidget()->IsClosed()); | |
|
Peter Kasting
2016/11/03 00:56:39
Nit: Why CHECK and not DCHECK? Generally we shoul
Evan Stade
2016/11/03 15:55:28
Devlin has expressed a preference for CHECK. I'm h
| |
| 265 } | 266 } |
| 266 | 267 |
| 267 void ExtensionInstalledBubbleView::LinkClicked(views::Link* source, | 268 void ExtensionInstalledBubbleView::LinkClicked(views::Link* source, |
| 268 int event_flags) { | 269 int event_flags) { |
| 269 DCHECK_EQ(manage_shortcut_, source); | 270 DCHECK_EQ(manage_shortcut_, source); |
| 270 | 271 |
| 271 std::string configure_url = chrome::kChromeUIExtensionsURL; | 272 std::string configure_url = chrome::kChromeUIExtensionsURL; |
| 272 configure_url += chrome::kExtensionConfigureCommandsSubPage; | 273 configure_url += chrome::kExtensionConfigureCommandsSubPage; |
| 273 chrome::NavigateParams params( | 274 chrome::NavigateParams params( |
| 274 chrome::GetSingletonTabNavigateParams(browser(), GURL(configure_url))); | 275 chrome::GetSingletonTabNavigateParams(browser(), GURL(configure_url))); |
| 275 chrome::Navigate(¶ms); | 276 chrome::Navigate(¶ms); |
| 276 CloseBubble(); | 277 // Navigating will cause the bubble to close. |
| 278 CHECK(GetWidget()->IsClosed()); | |
| 277 } | 279 } |
| 278 | 280 |
| 279 gfx::Size ExtensionInstalledBubbleView::GetIconSize() const { | 281 gfx::Size ExtensionInstalledBubbleView::GetIconSize() const { |
| 280 const SkBitmap& bitmap = controller_->icon(); | 282 const SkBitmap& bitmap = controller_->icon(); |
| 281 // Scale down to 43x43, but allow smaller icons (don't scale up). | 283 // Scale down to 43x43, but allow smaller icons (don't scale up). |
| 282 gfx::Size size(bitmap.width(), bitmap.height()); | 284 gfx::Size size(bitmap.width(), bitmap.height()); |
| 283 return size.width() > kIconSize || size.height() > kIconSize | 285 return size.width() > kIconSize || size.height() > kIconSize |
| 284 ? gfx::Size(kIconSize, kIconSize) | 286 ? gfx::Size(kIconSize, kIconSize) |
| 285 : size; | 287 : size; |
| 286 } | 288 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 ->browser_actions(); | 356 ->browser_actions(); |
| 355 return !container->animating(); | 357 return !container->animating(); |
| 356 } | 358 } |
| 357 return true; | 359 return true; |
| 358 } | 360 } |
| 359 | 361 |
| 360 // Implemented here to create the platform specific instance of the BubbleUi. | 362 // Implemented here to create the platform specific instance of the BubbleUi. |
| 361 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { | 363 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { |
| 362 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); | 364 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); |
| 363 } | 365 } |
| OLD | NEW |