Commit 848ef69a authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Don't use the odd yellow-ish highlight rect around the whole...

Don't use the odd yellow-ish highlight rect around the whole BrowserActionsContainer. Instead, highlight each button as needed.

TBR=oshima@chromium.org

Bug: 817180
Change-Id: I9005dd611534b69127dbbcfec666ffb2a81da27d
Reviewed-on: https://chromium-review.googlesource.com/952087
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541939}
parent 802783eb
...@@ -87,15 +87,17 @@ ...@@ -87,15 +87,17 @@
</if> </if>
<structure type="chrome_scaled_image" name="IDR_COOKIES" file="common/cookies.png" /> <structure type="chrome_scaled_image" name="IDR_COOKIES" file="common/cookies.png" />
<structure type="chrome_scaled_image" name="IDR_COOKIE_STORAGE_ICON" file="common/cookie_storage.png" /> <structure type="chrome_scaled_image" name="IDR_COOKIE_STORAGE_ICON" file="common/cookie_storage.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_BOTTOM_LEFT" file="common/developer_mode_highlight_bottom_left.png" /> <if expr="is_macosx">
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_BOTTOM" file="common/developer_mode_highlight_bottom.png" /> <structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_BOTTOM_LEFT" file="common/developer_mode_highlight_bottom_left.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_BOTTOM_RIGHT" file="common/developer_mode_highlight_bottom_right.png" /> <structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_BOTTOM" file="common/developer_mode_highlight_bottom.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_CENTER" file="common/developer_mode_highlight_center.png" /> <structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_BOTTOM_RIGHT" file="common/developer_mode_highlight_bottom_right.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_LEFT" file="common/developer_mode_highlight_left.png" /> <structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_CENTER" file="common/developer_mode_highlight_center.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_RIGHT" file="common/developer_mode_highlight_right.png" /> <structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_LEFT" file="common/developer_mode_highlight_left.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_TOP_LEFT" file="common/developer_mode_highlight_top_left.png" /> <structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_RIGHT" file="common/developer_mode_highlight_right.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_TOP" file="common/developer_mode_highlight_top.png" /> <structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_TOP_LEFT" file="common/developer_mode_highlight_top_left.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_TOP_RIGHT" file="common/developer_mode_highlight_top_right.png" /> <structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_TOP" file="common/developer_mode_highlight_top.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_TOP_RIGHT" file="common/developer_mode_highlight_top_right.png" />
</if>
<if expr="chromeos"> <if expr="chromeos">
<structure type="chrome_scaled_image" name="IDR_DEVICE_DISABLED" file="cros/device_disabled.png" /> <structure type="chrome_scaled_image" name="IDR_DEVICE_DISABLED" file="cros/device_disabled.png" />
</if> </if>
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_model.h" #include "chrome/browser/ui/toolbar/toolbar_actions_model.h"
#include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h"
...@@ -30,13 +29,11 @@ ...@@ -30,13 +29,11 @@
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/nine_image_painter_factory.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/views/bubble/bubble_dialog_delegate.h" #include "ui/views/bubble/bubble_dialog_delegate.h"
#include "ui/views/controls/resize_area.h" #include "ui/views/controls/resize_area.h"
#include "ui/views/painter.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
...@@ -81,9 +78,6 @@ BrowserActionsContainer::BrowserActionsContainer( ...@@ -81,9 +78,6 @@ BrowserActionsContainer::BrowserActionsContainer(
AddChildView(resize_area_); AddChildView(resize_area_);
} }
resize_animation_.reset(new gfx::SlideAnimation(this)); resize_animation_.reset(new gfx::SlideAnimation(this));
const int kWarningImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT);
warning_highlight_painter_ =
views::Painter::CreateImageGridPainter(kWarningImages);
} }
} }
...@@ -327,7 +321,7 @@ gfx::Size BrowserActionsContainer::GetMinimumSize() const { ...@@ -327,7 +321,7 @@ gfx::Size BrowserActionsContainer::GetMinimumSize() const {
} }
void BrowserActionsContainer::Layout() { void BrowserActionsContainer::Layout() {
if (toolbar_actions_bar_->suppress_layout()) if (toolbar_actions_bar()->suppress_layout())
return; return;
if (toolbar_action_views_.empty()) { if (toolbar_action_views_.empty()) {
...@@ -341,8 +335,8 @@ void BrowserActionsContainer::Layout() { ...@@ -341,8 +335,8 @@ void BrowserActionsContainer::Layout() {
// The range of visible icons, from start_index (inclusive) to end_index // The range of visible icons, from start_index (inclusive) to end_index
// (exclusive). // (exclusive).
size_t start_index = toolbar_actions_bar_->GetStartIndexInBounds(); size_t start_index = toolbar_actions_bar()->GetStartIndexInBounds();
size_t end_index = toolbar_actions_bar_->GetEndIndexInBounds(); size_t end_index = toolbar_actions_bar()->GetEndIndexInBounds();
// Now draw the icons for the actions in the available space. Once all the // Now draw the icons for the actions in the available space. Once all the
// variables are in place, the layout works equally well for the main and // variables are in place, the layout works equally well for the main and
...@@ -352,8 +346,14 @@ void BrowserActionsContainer::Layout() { ...@@ -352,8 +346,14 @@ void BrowserActionsContainer::Layout() {
if (i < start_index || i >= end_index) { if (i < start_index || i >= end_index) {
view->SetVisible(false); view->SetVisible(false);
} else { } else {
view->SetBoundsRect(toolbar_actions_bar_->GetFrameForIndex(i)); view->SetBoundsRect(toolbar_actions_bar()->GetFrameForIndex(i));
view->SetVisible(true); view->SetVisible(true);
if (!ShownInsideMenu()) {
view->AnimateInkDrop(toolbar_actions_bar()->is_highlighting()
? views::InkDropState::ACTIVATED
: views::InkDropState::HIDDEN,
nullptr);
}
} }
} }
} }
...@@ -590,14 +590,6 @@ content::WebContents* BrowserActionsContainer::GetCurrentWebContents() { ...@@ -590,14 +590,6 @@ content::WebContents* BrowserActionsContainer::GetCurrentWebContents() {
} }
void BrowserActionsContainer::OnPaint(gfx::Canvas* canvas) { void BrowserActionsContainer::OnPaint(gfx::Canvas* canvas) {
// If the views haven't been initialized yet, wait for the next call to
// paint (one will be triggered by entering highlight mode).
if (toolbar_actions_bar_->is_highlighting() &&
!toolbar_action_views_.empty() && !ShownInsideMenu()) {
views::Painter::PaintPainterAt(canvas, warning_highlight_painter_.get(),
GetLocalBounds());
}
// TODO(sky/glen): Instead of using a drop indicator, animate the icons while // TODO(sky/glen): Instead of using a drop indicator, animate the icons while
// dragging (like we do for tab dragging). // dragging (like we do for tab dragging).
if (drop_position_.get()) { if (drop_position_.get()) {
......
...@@ -279,9 +279,6 @@ class BrowserActionsContainer : public views::View, ...@@ -279,9 +279,6 @@ class BrowserActionsContainer : public views::View,
// The resize area for the container. // The resize area for the container.
views::ResizeArea* resize_area_ = nullptr; views::ResizeArea* resize_area_ = nullptr;
// The painter used when we are highlighting a subset of extensions.
std::unique_ptr<views::Painter> warning_highlight_painter_;
// The animation that happens when the container snaps to place. // The animation that happens when the container snaps to place.
std::unique_ptr<gfx::SlideAnimation> resize_animation_; std::unique_ptr<gfx::SlideAnimation> resize_animation_;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "ui/base/theme_provider.h" #include "ui/base/theme_provider.h"
#include "ui/compositor/paint_recorder.h" #include "ui/compositor/paint_recorder.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h" #include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/image/image_skia_source.h" #include "ui/gfx/image/image_skia_source.h"
...@@ -102,8 +103,13 @@ SkColor ToolbarActionView::GetInkDropBaseColor() const { ...@@ -102,8 +103,13 @@ SkColor ToolbarActionView::GetInkDropBaseColor() const {
ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor); ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor);
} }
return GetThemeProvider()->GetColor( const ui::ThemeProvider* provider = GetThemeProvider();
ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
// There may not be a Widget available in the unit tests, thus there will be
// no ThemeProvider.
return provider
? provider->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON)
: gfx::kChromeIconGrey;
} }
bool ToolbarActionView::ShouldUseFloodFillInkDrop() const { bool ToolbarActionView::ShouldUseFloodFillInkDrop() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment