Chromium Code Reviews| Index: ash/common/system/chromeos/palette/palette_tool.cc |
| diff --git a/ash/common/system/chromeos/palette/palette_tool.cc b/ash/common/system/chromeos/palette/palette_tool.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..579ed7c60b39d12e998c357d6518a510d6671cf0 |
| --- /dev/null |
| +++ b/ash/common/system/chromeos/palette/palette_tool.cc |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2016 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 "ash/common/system/chromeos/palette/palette_tool.h" |
| + |
| +#include "ash/common/shelf/shelf_constants.h" |
| +#include "ash/common/system/chromeos/palette/palette_ids.h" |
| +#include "ash/common/system/chromeos/palette/palette_tool_manager.h" |
| +#include "ash/common/system/tray/hover_highlight_view.h" |
| +#include "ash/common/system/tray/view_click_listener.h" |
| +#include "base/strings/utf_string_conversions.h" |
| +#include "grit/ash_resources.h" |
| +#include "ui/base/resource/resource_bundle.h" |
| +#include "ui/gfx/paint_vector_icon.h" |
| +#include "ui/gfx/vector_icons_public.h" |
|
oshima
2016/07/14 13:58:32
Looks like not all headers are necessary?
jdufault
2016/07/18 20:39:57
Done, these are used in a dependent CL so I've mov
|
| + |
| +namespace ash { |
| + |
| +// static |
| +void PaletteTool::RegisterToolInstances(PaletteToolManager* tool_manager) {} |
|
oshima
2016/07/14 13:58:32
what is this for? or add TODO?
jdufault
2016/07/18 20:39:57
Added a comment.
|
| + |
| +PaletteTool::PaletteTool() {} |
| + |
| +PaletteTool::~PaletteTool() {} |
| + |
| +void PaletteTool::Initialize(WmWindow* window, |
| + const ToolAction& enable_tool, |
| + const ToolAction& disable_tool) { |
| + window_ = window; |
| + enable_tool_ = enable_tool; |
| + disable_tool_ = disable_tool; |
|
oshima
2016/07/14 13:58:32
in initializer list?
jdufault
2016/07/18 20:39:57
Not a constructor :(
|
| +} |
| + |
| +void PaletteTool::OnEnable() { |
| + enabled_ = true; |
| +} |
| + |
| +void PaletteTool::OnDisable() { |
| + enabled_ = false; |
| +} |
| + |
| +bool PaletteTool::enabled() const { |
| + return enabled_; |
|
oshima
2016/07/14 13:58:32
you may inline this.
jdufault
2016/07/18 20:39:57
Done.
|
| +} |
| + |
| +void PaletteTool::EnableSelf() { |
| + DCHECK(!enable_tool_.is_null()) << "PaletteTool was not initialized"; |
| + |
| + enable_tool_.Run(tool_id()); |
| +} |
| + |
| +void PaletteTool::DisableSelf() { |
| + DCHECK(!disable_tool_.is_null()) << "PaletteTool was not initialized"; |
| + |
| + disable_tool_.Run(tool_id()); |
| +} |
| + |
| +WmWindow* PaletteTool::window() const { |
| + return window_; |
| +} |
|
oshima
2016/07/14 13:58:32
this too
jdufault
2016/07/18 20:39:57
Done.
|
| + |
| +} // namespace ash |