Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc

Issue 2042073002: Centered flood fill style ink drop ripples on mouse/touch points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polished for review. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/location_bar/icon_label_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ui/layout_constants.h" 8 #include "chrome/browser/ui/layout_constants.h"
9 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" 9 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h"
10 #include "ui/base/material_design/material_design_controller.h" 10 #include "ui/base/material_design/material_design_controller.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 double IconLabelBubbleView::WidthMultiplier() const { 112 double IconLabelBubbleView::WidthMultiplier() const {
113 return 1.0; 113 return 1.0;
114 } 114 }
115 115
116 bool IconLabelBubbleView::IsShrinking() const { 116 bool IconLabelBubbleView::IsShrinking() const {
117 return false; 117 return false;
118 } 118 }
119 119
120 bool IconLabelBubbleView::OnActivate() { 120 bool IconLabelBubbleView::OnActivate(const ui::Event* event) {
121 return false; 121 return false;
122 } 122 }
123 123
124 gfx::Size IconLabelBubbleView::GetPreferredSize() const { 124 gfx::Size IconLabelBubbleView::GetPreferredSize() const {
125 // Height will be ignored by the LocationBarView. 125 // Height will be ignored by the LocationBarView.
126 return GetSizeForLabelWidth(label_->GetPreferredSize().width()); 126 return GetSizeForLabelWidth(label_->GetPreferredSize().width());
127 } 127 }
128 128
129 bool IconLabelBubbleView::OnKeyPressed(const ui::KeyEvent& event) { 129 bool IconLabelBubbleView::OnKeyPressed(const ui::KeyEvent& event) {
130 if (event.key_code() == ui::VKEY_RETURN) 130 if (event.key_code() == ui::VKEY_RETURN)
131 return OnActivate(); 131 return OnActivate(&event);
132 return false; 132 return false;
133 } 133 }
134 134
135 bool IconLabelBubbleView::OnKeyReleased(const ui::KeyEvent& event) { 135 bool IconLabelBubbleView::OnKeyReleased(const ui::KeyEvent& event) {
136 if (event.key_code() == ui::VKEY_SPACE) 136 if (event.key_code() == ui::VKEY_SPACE)
137 return OnActivate(); 137 return OnActivate(&event);
138 return false; 138 return false;
139 } 139 }
140 140
141 void IconLabelBubbleView::Layout() { 141 void IconLabelBubbleView::Layout() {
142 // Compute the image bounds. In non-MD, the leading padding depends on 142 // Compute the image bounds. In non-MD, the leading padding depends on
143 // whether this is an extension icon, since extension icons and 143 // whether this is an extension icon, since extension icons and
144 // Chrome-provided icons are different sizes. In MD, these sizes are the 144 // Chrome-provided icons are different sizes. In MD, these sizes are the
145 // same, so it's not necessary to handle the two types differently. 145 // same, so it's not necessary to handle the two types differently.
146 const bool icon_has_enough_padding = 146 const bool icon_has_enough_padding =
147 !is_extension_icon_ || ui::MaterialDesignController::IsModeMaterial(); 147 !is_extension_icon_ || ui::MaterialDesignController::IsModeMaterial();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 // 1px at all scale factors. 320 // 1px at all scale factors.
321 gfx::ScopedCanvas scoped_canvas(canvas); 321 gfx::ScopedCanvas scoped_canvas(canvas);
322 const float scale = canvas->UndoDeviceScaleFactor(); 322 const float scale = canvas->UndoDeviceScaleFactor();
323 const gfx::RectF pixel_aligned_bounds = 323 const gfx::RectF pixel_aligned_bounds =
324 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); 324 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0);
325 canvas->DrawLine(pixel_aligned_bounds.top_right(), 325 canvas->DrawLine(pixel_aligned_bounds.top_right(),
326 pixel_aligned_bounds.bottom_right(), separator_color); 326 pixel_aligned_bounds.bottom_right(), separator_color);
327 } 327 }
328 } 328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698