| 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 "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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 DCHECK(extension_action); | 54 DCHECK(extension_action); |
| 55 DCHECK(extension_action->action_type() == ActionInfo::TYPE_PAGE || | 55 DCHECK(extension_action->action_type() == ActionInfo::TYPE_PAGE || |
| 56 extension_action->action_type() == ActionInfo::TYPE_BROWSER); | 56 extension_action->action_type() == ActionInfo::TYPE_BROWSER); |
| 57 DCHECK(extension); | 57 DCHECK(extension); |
| 58 } | 58 } |
| 59 | 59 |
| 60 ExtensionActionViewController::~ExtensionActionViewController() { | 60 ExtensionActionViewController::~ExtensionActionViewController() { |
| 61 DCHECK(!is_showing_popup()); | 61 DCHECK(!is_showing_popup()); |
| 62 } | 62 } |
| 63 | 63 |
| 64 const std::string& ExtensionActionViewController::GetId() const { | 64 std::string ExtensionActionViewController::GetId() const { |
| 65 return extension_->id(); | 65 return extension_->id(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void ExtensionActionViewController::SetDelegate( | 68 void ExtensionActionViewController::SetDelegate( |
| 69 ToolbarActionViewDelegate* delegate) { | 69 ToolbarActionViewDelegate* delegate) { |
| 70 DCHECK((delegate == nullptr) ^ (view_delegate_ == nullptr)); | 70 DCHECK((delegate == nullptr) ^ (view_delegate_ == nullptr)); |
| 71 if (delegate) { | 71 if (delegate) { |
| 72 view_delegate_ = delegate; | 72 view_delegate_ = delegate; |
| 73 platform_delegate_->OnDelegateSet(); | 73 platform_delegate_->OnDelegateSet(); |
| 74 } else { | 74 } else { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // overflowed, we add a decoration so that the user can see which overflowed | 389 // overflowed, we add a decoration so that the user can see which overflowed |
| 390 // action wants to run (since they wouldn't be able to see the change from | 390 // action wants to run (since they wouldn't be able to see the change from |
| 391 // grayscale to color). | 391 // grayscale to color). |
| 392 bool is_overflow = | 392 bool is_overflow = |
| 393 toolbar_actions_bar_ && toolbar_actions_bar_->in_overflow_mode(); | 393 toolbar_actions_bar_ && toolbar_actions_bar_->in_overflow_mode(); |
| 394 image_source->set_paint_decoration(WantsToRun(web_contents) && is_overflow); | 394 image_source->set_paint_decoration(WantsToRun(web_contents) && is_overflow); |
| 395 } | 395 } |
| 396 | 396 |
| 397 return image_source.Pass(); | 397 return image_source.Pass(); |
| 398 } | 398 } |
| OLD | NEW |