| Index: chrome/browser/ui/toolbar/test_toolbar_action_view_controller.cc
|
| diff --git a/chrome/browser/ui/toolbar/test_toolbar_action_view_controller.cc b/chrome/browser/ui/toolbar/test_toolbar_action_view_controller.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c6c910750b84822cb6cfa3f11a94c233482d3b94
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/toolbar/test_toolbar_action_view_controller.cc
|
| @@ -0,0 +1,129 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/ui/toolbar/test_toolbar_action_view_controller.h"
|
| +
|
| +#include "base/strings/string16.h"
|
| +#include "chrome/browser/ui/toolbar/toolbar_action_view_delegate.h"
|
| +#include "ui/gfx/image/image.h"
|
| +#include "ui/gfx/image/image_skia.h"
|
| +
|
| +TestToolbarActionViewController::TestToolbarActionViewController(
|
| + const std::string& id)
|
| + : id_(id),
|
| + delegate_(nullptr),
|
| + is_enabled_(true),
|
| + wants_to_run_(false),
|
| + execute_action_count_(0) {
|
| +}
|
| +
|
| +TestToolbarActionViewController::~TestToolbarActionViewController() {
|
| +}
|
| +
|
| +const std::string& TestToolbarActionViewController::GetId() const {
|
| + return id_;
|
| +}
|
| +
|
| +void TestToolbarActionViewController::SetDelegate(
|
| + ToolbarActionViewDelegate* delegate) {
|
| + delegate_ = delegate;
|
| +}
|
| +
|
| +gfx::Image TestToolbarActionViewController::GetIcon(
|
| + content::WebContents* web_contents) {
|
| + return gfx::Image();
|
| +}
|
| +
|
| +gfx::ImageSkia TestToolbarActionViewController::GetIconWithBadge() {
|
| + return gfx::ImageSkia();
|
| +}
|
| +
|
| +base::string16 TestToolbarActionViewController::GetActionName() const {
|
| + return base::string16();
|
| +}
|
| +
|
| +base::string16 TestToolbarActionViewController::GetAccessibleName(
|
| + content::WebContents* web_contents) const {
|
| + return accessible_name_;
|
| +}
|
| +
|
| +base::string16 TestToolbarActionViewController::GetTooltip(
|
| + content::WebContents* web_contents) const {
|
| + return tooltip_;
|
| +}
|
| +
|
| +bool TestToolbarActionViewController::IsEnabled(
|
| + content::WebContents* web_contents) const {
|
| + return is_enabled_;
|
| +}
|
| +
|
| +bool TestToolbarActionViewController::WantsToRun(
|
| + content::WebContents* web_contents) const {
|
| + return wants_to_run_;
|
| +}
|
| +
|
| +bool TestToolbarActionViewController::HasPopup(
|
| + content::WebContents* web_contents) const {
|
| + return true;
|
| +}
|
| +
|
| +void TestToolbarActionViewController::HidePopup() {
|
| + delegate_->OnPopupClosed();
|
| +}
|
| +
|
| +gfx::NativeView TestToolbarActionViewController::GetPopupNativeView() {
|
| + return nullptr;
|
| +}
|
| +
|
| +ui::MenuModel* TestToolbarActionViewController::GetContextMenu() {
|
| + return nullptr;
|
| +}
|
| +
|
| +bool TestToolbarActionViewController::IsMenuRunning() const {
|
| + return false;
|
| +}
|
| +
|
| +bool TestToolbarActionViewController::CanDrag() const {
|
| + return false;
|
| +}
|
| +
|
| +bool TestToolbarActionViewController::ExecuteAction(bool by_user) {
|
| + ++execute_action_count_;
|
| + return false;
|
| +}
|
| +
|
| +void TestToolbarActionViewController::UpdateState() {
|
| + UpdateDelegate();
|
| +}
|
| +
|
| +void TestToolbarActionViewController::ShowPopup(bool by_user) {
|
| + delegate_->OnPopupShown(by_user);
|
| +}
|
| +
|
| +void TestToolbarActionViewController::SetAccessibleName(
|
| + const base::string16& name) {
|
| + accessible_name_ = name;
|
| + UpdateDelegate();
|
| +}
|
| +
|
| +void TestToolbarActionViewController::SetTooltip(
|
| + const base::string16& tooltip) {
|
| + tooltip_ = tooltip;
|
| + UpdateDelegate();
|
| +}
|
| +
|
| +void TestToolbarActionViewController::SetEnabled(bool is_enabled) {
|
| + is_enabled_ = is_enabled;
|
| + UpdateDelegate();
|
| +}
|
| +
|
| +void TestToolbarActionViewController::SetWantsToRun(bool wants_to_run) {
|
| + wants_to_run_ = wants_to_run;
|
| + UpdateDelegate();
|
| +}
|
| +
|
| +void TestToolbarActionViewController::UpdateDelegate() {
|
| + if (delegate_)
|
| + delegate_->UpdateState();
|
| +}
|
|
|