OLD | NEW |
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/extensions/extension_action_view_controller.h" | 5 #include "chrome/browser/ui/extensions/extension_action_view_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return extension_->id(); | 67 return extension_->id(); |
68 } | 68 } |
69 | 69 |
70 void ExtensionActionViewController::SetDelegate( | 70 void ExtensionActionViewController::SetDelegate( |
71 ToolbarActionViewDelegate* delegate) { | 71 ToolbarActionViewDelegate* delegate) { |
72 DCHECK((delegate == nullptr) ^ (view_delegate_ == nullptr)); | 72 DCHECK((delegate == nullptr) ^ (view_delegate_ == nullptr)); |
73 if (delegate) { | 73 if (delegate) { |
74 view_delegate_ = delegate; | 74 view_delegate_ = delegate; |
75 platform_delegate_->OnDelegateSet(); | 75 platform_delegate_->OnDelegateSet(); |
76 } else { | 76 } else { |
77 if (is_showing_popup()) | 77 DCHECK(!is_showing_popup()); |
78 HidePopup(); | |
79 platform_delegate_.reset(); | 78 platform_delegate_.reset(); |
80 view_delegate_ = nullptr; | 79 view_delegate_ = nullptr; |
81 } | 80 } |
82 } | 81 } |
83 | 82 |
84 gfx::Image ExtensionActionViewController::GetIcon( | 83 gfx::Image ExtensionActionViewController::GetIcon( |
85 content::WebContents* web_contents, | 84 content::WebContents* web_contents, |
86 const gfx::Size& size) { | 85 const gfx::Size& size) { |
87 if (!ExtensionIsValid()) | 86 if (!ExtensionIsValid()) |
88 return gfx::Image(); | 87 return gfx::Image(); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 extension_action_->GetIsVisible( | 417 extension_action_->GetIsVisible( |
419 SessionTabHelper::IdForTab(web_contents)); | 418 SessionTabHelper::IdForTab(web_contents)); |
420 } | 419 } |
421 | 420 |
422 bool ExtensionActionViewController::HasBeenBlocked( | 421 bool ExtensionActionViewController::HasBeenBlocked( |
423 content::WebContents* web_contents) const { | 422 content::WebContents* web_contents) const { |
424 ExtensionActionRunner* action_runner = | 423 ExtensionActionRunner* action_runner = |
425 ExtensionActionRunner::GetForWebContents(web_contents); | 424 ExtensionActionRunner::GetForWebContents(web_contents); |
426 return action_runner && action_runner->WantsToRun(extension()); | 425 return action_runner && action_runner->WantsToRun(extension()); |
427 } | 426 } |
OLD | NEW |