Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: chrome/browser/ui/views/extensions/extension_action_platform_delegate_views.cc

Issue 878813003: [Extensions Toolbar] Ensure popup is closed at shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_action_platform_delegate_ views.h" 5 #include "chrome/browser/ui/views/extensions/extension_action_platform_delegate_ views.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/api/commands/command_service.h" 9 #include "chrome/browser/extensions/api/commands/command_service.h"
10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 notification_source); 62 notification_source);
63 registrar_.Add(this, 63 registrar_.Add(this,
64 extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED, 64 extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED,
65 notification_source); 65 notification_source);
66 } 66 }
67 67
68 ExtensionActionPlatformDelegateViews::~ExtensionActionPlatformDelegateViews() { 68 ExtensionActionPlatformDelegateViews::~ExtensionActionPlatformDelegateViews() {
69 DCHECK(!popup_); // We should never have a visible popup at shutdown. 69 DCHECK(!popup_); // We should never have a visible popup at shutdown.
70 if (context_menu_owner == this) 70 if (context_menu_owner == this)
71 context_menu_owner = nullptr; 71 context_menu_owner = nullptr;
72 // Since the popup close process is asynchronous, it might not be fully closed
73 // at shutdown. We still need to cleanup, though.
74 if (popup_)
75 CleanupPopup(true);
72 UnregisterCommand(false); 76 UnregisterCommand(false);
73 } 77 }
74 78
75 gfx::NativeView ExtensionActionPlatformDelegateViews::GetPopupNativeView() { 79 gfx::NativeView ExtensionActionPlatformDelegateViews::GetPopupNativeView() {
76 return popup_ ? popup_->GetWidget()->GetNativeView() : nullptr; 80 return popup_ ? popup_->GetWidget()->GetNativeView() : nullptr;
77 } 81 }
78 82
79 bool ExtensionActionPlatformDelegateViews::IsMenuRunning() const { 83 bool ExtensionActionPlatformDelegateViews::IsMenuRunning() const {
80 return menu_runner_.get() != NULL; 84 return menu_runner_.get() != NULL;
81 } 85 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 if (close_widget) 323 if (close_widget)
320 popup_->GetWidget()->Close(); 324 popup_->GetWidget()->Close();
321 popup_ = nullptr; 325 popup_ = nullptr;
322 } 326 }
323 327
324 ToolbarActionViewDelegateViews* 328 ToolbarActionViewDelegateViews*
325 ExtensionActionPlatformDelegateViews::GetDelegateViews() const { 329 ExtensionActionPlatformDelegateViews::GetDelegateViews() const {
326 return static_cast<ToolbarActionViewDelegateViews*>( 330 return static_cast<ToolbarActionViewDelegateViews*>(
327 controller_->view_delegate()); 331 controller_->view_delegate());
328 } 332 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698