| 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h" | 9 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h" |
| 10 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" | 10 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // ToolbarActionButtonController: | 29 // ToolbarActionButtonController: |
| 30 const std::string& GetId() const override { return id_; } | 30 const std::string& GetId() const override { return id_; } |
| 31 void SetDelegate(ToolbarActionViewDelegate* delegate) override {} | 31 void SetDelegate(ToolbarActionViewDelegate* delegate) override {} |
| 32 gfx::Image GetIcon(content::WebContents* web_contents) override { | 32 gfx::Image GetIcon(content::WebContents* web_contents) override { |
| 33 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 33 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 34 IDR_BROWSER_ACTION); | 34 IDR_BROWSER_ACTION); |
| 35 } | 35 } |
| 36 gfx::ImageSkia GetIconWithBadge() override { | 36 gfx::ImageSkia GetIconWithBadge() override { |
| 37 return *GetIcon(nullptr).ToImageSkia(); | 37 return *GetIcon(nullptr).ToImageSkia(); |
| 38 } | 38 } |
| 39 base::string16 GetAccessibleName( | 39 base::string16 GetActionName() const override { |
| 40 content::WebContents* web_contents) const override { | |
| 41 return base::ASCIIToUTF16("Component Action"); | 40 return base::ASCIIToUTF16("Component Action"); |
| 42 } | 41 } |
| 43 base::string16 GetTooltip(content::WebContents* web_contents) const override { | 42 base::string16 GetAccessibleName(content::WebContents* web_contents) |
| 44 return GetAccessibleName(web_contents); | 43 const override { |
| 44 return GetActionName(); |
| 45 } |
| 46 base::string16 GetTooltip(content::WebContents* web_contents) |
| 47 const override { |
| 48 return GetActionName(); |
| 45 } | 49 } |
| 46 bool IsEnabled(content::WebContents* web_contents) const override { | 50 bool IsEnabled(content::WebContents* web_contents) const override { |
| 47 return true; | 51 return true; |
| 48 } | 52 } |
| 49 bool HasPopup(content::WebContents* web_contents) const override { | 53 bool HasPopup(content::WebContents* web_contents) const override { |
| 50 return true; | 54 return true; |
| 51 } | 55 } |
| 52 void HidePopup() override {} | 56 void HidePopup() override {} |
| 53 gfx::NativeView GetPopupNativeView() override { return nullptr; } | 57 gfx::NativeView GetPopupNativeView() override { return nullptr; } |
| 54 bool CanDrag() const override { return false; } | 58 bool CanDrag() const override { return false; } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 browser_actions_container->GetToolbarActionViewAt(0u); | 136 browser_actions_container->GetToolbarActionViewAt(0u); |
| 133 ASSERT_EQ(kMockId, view->view_controller()->GetId()); | 137 ASSERT_EQ(kMockId, view->view_controller()->GetId()); |
| 134 MockComponentAction* mock_component_action = | 138 MockComponentAction* mock_component_action = |
| 135 static_cast<MockComponentAction*>(view->view_controller()); | 139 static_cast<MockComponentAction*>(view->view_controller()); |
| 136 | 140 |
| 137 // Test that clicking on the component action works. | 141 // Test that clicking on the component action works. |
| 138 EXPECT_EQ(0u, mock_component_action->click_count()); | 142 EXPECT_EQ(0u, mock_component_action->click_count()); |
| 139 view->Activate(); | 143 view->Activate(); |
| 140 EXPECT_EQ(1u, mock_component_action->click_count()); | 144 EXPECT_EQ(1u, mock_component_action->click_count()); |
| 141 } | 145 } |
| OLD | NEW |