Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / toolbar / test_toolbar_action_view_controller.h
blob72a0f829ff31d1f0e5d6465a71cbbd6456e9b980
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTION_VIEW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTION_VIEW_CONTROLLER_H_
8 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
10 // A minimalistic and configurable ToolbarActionViewController for use in
11 // testing.
12 class TestToolbarActionViewController : public ToolbarActionViewController {
13 public:
14 explicit TestToolbarActionViewController(const std::string& id);
15 ~TestToolbarActionViewController() override;
17 // ToolbarActionViewController:
18 std::string GetId() const override;
19 void SetDelegate(ToolbarActionViewDelegate* delegate) override;
20 gfx::Image GetIcon(content::WebContents* web_contents,
21 const gfx::Size& size) override;
22 base::string16 GetActionName() const override;
23 base::string16 GetAccessibleName(content::WebContents* web_contents)
24 const override;
25 base::string16 GetTooltip(content::WebContents* web_contents)
26 const override;
27 bool IsEnabled(content::WebContents* web_contents) const override;
28 bool WantsToRun(content::WebContents* web_contents) const override;
29 bool HasPopup(content::WebContents* web_contents) const override;
30 void HidePopup() override;
31 gfx::NativeView GetPopupNativeView() override;
32 ui::MenuModel* GetContextMenu() override;
33 bool ExecuteAction(bool by_user) override;
34 void UpdateState() override;
35 bool DisabledClickOpensMenu() const override;
37 // Instruct the controller to fake showing a popup.
38 void ShowPopup(bool by_user);
40 // Configure the test controller. These also call UpdateDelegate().
41 void SetAccessibleName(const base::string16& name);
42 void SetTooltip(const base::string16& tooltip);
43 void SetEnabled(bool is_enabled);
44 void SetWantsToRun(bool wants_to_run);
45 void SetDisabledClickOpensMenu(bool disabled_click_opens_menu);
47 int execute_action_count() const { return execute_action_count_; }
49 private:
50 // Updates the delegate, if one exists.
51 void UpdateDelegate();
53 // The id of the controller.
54 std::string id_;
56 // The delegate of the controller, if one exists.
57 ToolbarActionViewDelegate* delegate_;
59 // The optional accessible name and tooltip; by default these are empty.
60 base::string16 accessible_name_;
61 base::string16 tooltip_;
63 // Whether or not the action is enabled. Defaults to true.
64 bool is_enabled_;
66 // Whether or not the action wants to run. Defaults to false.
67 bool wants_to_run_;
69 // Whether or not a click on a disabled action should open the context menu.
70 bool disabled_click_opens_menu_;
72 // The number of times the action would have been executed.
73 int execute_action_count_;
75 DISALLOW_COPY_AND_ASSIGN(TestToolbarActionViewController);
78 #endif // CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_ACTION_VIEW_CONTROLLER_H_