| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/views/toolbar/toolbar_action_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/sessions/session_tab_helper.h" | 11 #include "chrome/browser/sessions/session_tab_helper.h" |
| 12 #include "chrome/browser/themes/theme_properties.h" |
| 12 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" | 13 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
| 13 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" | 14 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" |
| 14 #include "chrome/browser/ui/view_ids.h" | 15 #include "chrome/browser/ui/view_ids.h" |
| 15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 16 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 17 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 18 #include "ui/accessibility/ax_view_state.h" | 19 #include "ui/accessibility/ax_view_state.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/base/theme_provider.h" |
| 20 #include "ui/compositor/paint_recorder.h" | 22 #include "ui/compositor/paint_recorder.h" |
| 21 #include "ui/events/event.h" | 23 #include "ui/events/event.h" |
| 22 #include "ui/gfx/image/image_skia.h" | 24 #include "ui/gfx/image/image_skia.h" |
| 23 #include "ui/gfx/image/image_skia_operations.h" | 25 #include "ui/gfx/image/image_skia_operations.h" |
| 24 #include "ui/gfx/image/image_skia_source.h" | 26 #include "ui/gfx/image/image_skia_source.h" |
| 25 #include "ui/resources/grit/ui_resources.h" | 27 #include "ui/resources/grit/ui_resources.h" |
| 26 #include "ui/views/animation/button_ink_drop_delegate.h" | 28 #include "ui/views/animation/button_ink_drop_delegate.h" |
| 27 #include "ui/views/controls/button/label_button_border.h" | 29 #include "ui/views/controls/button/label_button_border.h" |
| 28 #include "ui/views/controls/menu/menu_controller.h" | 30 #include "ui/views/controls/menu/menu_controller.h" |
| 29 #include "ui/views/controls/menu/menu_model_adapter.h" | 31 #include "ui/views/controls/menu/menu_model_adapter.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 image()->SetFillsBoundsOpaquely(false); | 128 image()->SetFillsBoundsOpaquely(false); |
| 127 views::MenuButton::AddInkDropLayer(ink_drop_layer); | 129 views::MenuButton::AddInkDropLayer(ink_drop_layer); |
| 128 } | 130 } |
| 129 | 131 |
| 130 void ToolbarActionView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 132 void ToolbarActionView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
| 131 views::MenuButton::RemoveInkDropLayer(ink_drop_layer); | 133 views::MenuButton::RemoveInkDropLayer(ink_drop_layer); |
| 132 image()->SetFillsBoundsOpaquely(true); | 134 image()->SetFillsBoundsOpaquely(true); |
| 133 image()->SetPaintToLayer(false); | 135 image()->SetPaintToLayer(false); |
| 134 } | 136 } |
| 135 | 137 |
| 138 SkColor ToolbarActionView::GetInkDropBaseColor() const { |
| 139 return GetThemeProvider()->GetColor( |
| 140 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
| 141 } |
| 142 |
| 136 content::WebContents* ToolbarActionView::GetCurrentWebContents() const { | 143 content::WebContents* ToolbarActionView::GetCurrentWebContents() const { |
| 137 return delegate_->GetCurrentWebContents(); | 144 return delegate_->GetCurrentWebContents(); |
| 138 } | 145 } |
| 139 | 146 |
| 140 void ToolbarActionView::UpdateState() { | 147 void ToolbarActionView::UpdateState() { |
| 141 content::WebContents* web_contents = GetCurrentWebContents(); | 148 content::WebContents* web_contents = GetCurrentWebContents(); |
| 142 if (SessionTabHelper::IdForTab(web_contents) < 0) | 149 if (SessionTabHelper::IdForTab(web_contents) < 0) |
| 143 return; | 150 return; |
| 144 | 151 |
| 145 if (!view_controller_->IsEnabled(web_contents) && | 152 if (!view_controller_->IsEnabled(web_contents) && |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 if (menu_controller->in_nested_run()) { | 361 if (menu_controller->in_nested_run()) { |
| 355 // There is another menu showing. Close the outermost menu (since we are | 362 // There is another menu showing. Close the outermost menu (since we are |
| 356 // shown in the same menu, we don't want to close the whole thing). | 363 // shown in the same menu, we don't want to close the whole thing). |
| 357 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); | 364 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); |
| 358 return true; | 365 return true; |
| 359 } | 366 } |
| 360 } | 367 } |
| 361 | 368 |
| 362 return false; | 369 return false; |
| 363 } | 370 } |
| OLD | NEW |