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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 break; | 150 break; |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Default case. | 153 // Default case. |
| 154 if (!reference_view || !reference_view->visible()) | 154 if (!reference_view || !reference_view->visible()) |
| 155 reference_view = browser_view->toolbar()->app_menu_button(); | 155 reference_view = browser_view->toolbar()->app_menu_button(); |
| 156 SetAnchorView(reference_view); | 156 SetAnchorView(reference_view); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void ExtensionInstalledBubbleView::CloseBubble() { | 159 void ExtensionInstalledBubbleView::CloseBubble() { |
| 160 if (controller_ && controller_->anchor_position() == | 160 // This function should only be called once. |
| 161 DCHECK(!GetWidget()->IsClosed()); | |
|
Devlin
2016/10/26 14:34:58
nit: I'd be more comfortable with this being a rel
Evan Stade
2016/10/26 17:24:22
Done.
| |
| 162 if (controller_->anchor_position() == | |
| 161 ExtensionInstalledBubble::ANCHOR_PAGE_ACTION) { | 163 ExtensionInstalledBubble::ANCHOR_PAGE_ACTION) { |
| 162 BrowserView* browser_view = | 164 BrowserView* browser_view = |
| 163 BrowserView::GetBrowserViewForBrowser(browser()); | 165 BrowserView::GetBrowserViewForBrowser(browser()); |
| 164 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 166 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
| 165 extensions::ExtensionActionManager::Get(browser()->profile()) | 167 extensions::ExtensionActionManager::Get(browser()->profile()) |
| 166 ->GetPageAction(*controller_->extension()), | 168 ->GetPageAction(*controller_->extension()), |
| 167 false); // preview_enabled | 169 false); // preview_enabled |
| 168 } | 170 } |
| 169 controller_ = nullptr; | |
| 170 GetWidget()->Close(); | 171 GetWidget()->Close(); |
| 171 } | 172 } |
| 172 | 173 |
| 173 base::string16 ExtensionInstalledBubbleView::GetWindowTitle() const { | 174 base::string16 ExtensionInstalledBubbleView::GetWindowTitle() const { |
| 174 // Add the heading (for all options). | 175 // Add the heading (for all options). |
| 175 base::string16 extension_name = | 176 base::string16 extension_name = |
| 176 base::UTF8ToUTF16(controller_->extension()->name()); | 177 base::UTF8ToUTF16(controller_->extension()->name()); |
| 177 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 178 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
| 178 return l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, | 179 return l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, |
| 179 extension_name); | 180 extension_name); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 ->browser_actions(); | 354 ->browser_actions(); |
| 354 return !container->animating(); | 355 return !container->animating(); |
| 355 } | 356 } |
| 356 return true; | 357 return true; |
| 357 } | 358 } |
| 358 | 359 |
| 359 // Implemented here to create the platform specific instance of the BubbleUi. | 360 // Implemented here to create the platform specific instance of the BubbleUi. |
| 360 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { | 361 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { |
| 361 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); | 362 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); |
| 362 } | 363 } |
| OLD | NEW |