| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTION_VIEW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTION_VIEW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTION_VIEW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTION_VIEW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" | 8 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
| 9 | 9 |
| 10 // A minimalistic and configurable ToolbarActionViewController for use in | 10 // A minimalistic and configurable ToolbarActionViewController for use in |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const override; | 26 const override; |
| 27 bool IsEnabled(content::WebContents* web_contents) const override; | 27 bool IsEnabled(content::WebContents* web_contents) const override; |
| 28 bool WantsToRun(content::WebContents* web_contents) const override; | 28 bool WantsToRun(content::WebContents* web_contents) const override; |
| 29 bool HasPopup(content::WebContents* web_contents) const override; | 29 bool HasPopup(content::WebContents* web_contents) const override; |
| 30 void HidePopup() override; | 30 void HidePopup() override; |
| 31 gfx::NativeView GetPopupNativeView() override; | 31 gfx::NativeView GetPopupNativeView() override; |
| 32 ui::MenuModel* GetContextMenu() override; | 32 ui::MenuModel* GetContextMenu() override; |
| 33 bool CanDrag() const override; | 33 bool CanDrag() const override; |
| 34 bool ExecuteAction(bool by_user) override; | 34 bool ExecuteAction(bool by_user) override; |
| 35 void UpdateState() override; | 35 void UpdateState() override; |
| 36 bool DisabledClickOpensMenu() const override; |
| 36 | 37 |
| 37 // Instruct the controller to fake showing a popup. | 38 // Instruct the controller to fake showing a popup. |
| 38 void ShowPopup(bool by_user); | 39 void ShowPopup(bool by_user); |
| 39 | 40 |
| 40 // Configure the test controller. These also call UpdateDelegate(). | 41 // Configure the test controller. These also call UpdateDelegate(). |
| 41 void SetAccessibleName(const base::string16& name); | 42 void SetAccessibleName(const base::string16& name); |
| 42 void SetTooltip(const base::string16& tooltip); | 43 void SetTooltip(const base::string16& tooltip); |
| 43 void SetEnabled(bool is_enabled); | 44 void SetEnabled(bool is_enabled); |
| 44 void SetWantsToRun(bool wants_to_run); | 45 void SetWantsToRun(bool wants_to_run); |
| 46 void SetDisabledClickOpensMenu(bool disabled_click_opens_menu); |
| 45 | 47 |
| 46 int execute_action_count() const { return execute_action_count_; } | 48 int execute_action_count() const { return execute_action_count_; } |
| 47 | 49 |
| 48 private: | 50 private: |
| 49 // Updates the delegate, if one exists. | 51 // Updates the delegate, if one exists. |
| 50 void UpdateDelegate(); | 52 void UpdateDelegate(); |
| 51 | 53 |
| 52 // The id of the controller. | 54 // The id of the controller. |
| 53 std::string id_; | 55 std::string id_; |
| 54 | 56 |
| 55 // The delegate of the controller, if one exists. | 57 // The delegate of the controller, if one exists. |
| 56 ToolbarActionViewDelegate* delegate_; | 58 ToolbarActionViewDelegate* delegate_; |
| 57 | 59 |
| 58 // The optional accessible name and tooltip; by default these are empty. | 60 // The optional accessible name and tooltip; by default these are empty. |
| 59 base::string16 accessible_name_; | 61 base::string16 accessible_name_; |
| 60 base::string16 tooltip_; | 62 base::string16 tooltip_; |
| 61 | 63 |
| 62 // Whether or not the action is enabled. Defaults to true. | 64 // Whether or not the action is enabled. Defaults to true. |
| 63 bool is_enabled_; | 65 bool is_enabled_; |
| 64 | 66 |
| 65 // Whether or not the action wants to run. Defaults to false. | 67 // Whether or not the action wants to run. Defaults to false. |
| 66 bool wants_to_run_; | 68 bool wants_to_run_; |
| 67 | 69 |
| 70 // Whether or not a click on a disabled action should open the context menu. |
| 71 bool disabled_click_opens_menu_; |
| 72 |
| 68 // The number of times the action would have been executed. | 73 // The number of times the action would have been executed. |
| 69 int execute_action_count_; | 74 int execute_action_count_; |
| 70 | 75 |
| 71 DISALLOW_COPY_AND_ASSIGN(TestToolbarActionViewController); | 76 DISALLOW_COPY_AND_ASSIGN(TestToolbarActionViewController); |
| 72 }; | 77 }; |
| 73 | 78 |
| 74 #endif // CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTION_VIEW_CONTROLLER_H_ | 79 #endif // CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTION_VIEW_CONTROLLER_H_ |
| OLD | NEW |