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

Side by Side Diff: chrome/browser/ui/views/frame/glass_browser_frame_view.cc

Issue 380813003: Remove remaining overrides of View::HitTestRect() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase against ToT Created 6 years, 5 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 | Annotate | Revision Log
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/frame/glass_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 int frame_border_thickness = FrameBorderThickness(); 247 int frame_border_thickness = FrameBorderThickness();
248 int window_component = GetHTComponentForFrame(point, frame_border_thickness, 248 int window_component = GetHTComponentForFrame(point, frame_border_thickness,
249 nonclient_border_thickness, frame_border_thickness, 249 nonclient_border_thickness, frame_border_thickness,
250 kResizeAreaCornerSize - frame_border_thickness, 250 kResizeAreaCornerSize - frame_border_thickness,
251 frame()->widget_delegate()->CanResize()); 251 frame()->widget_delegate()->CanResize());
252 // Fall back to the caption if no other component matches. 252 // Fall back to the caption if no other component matches.
253 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; 253 return (window_component == HTNOWHERE) ? HTCAPTION : window_component;
254 } 254 }
255 255
256 bool GlassBrowserFrameView::DoesIntersectRect(const views::View* target,
257 const gfx::Rect& rect) const {
258 CHECK_EQ(target, this);
259 bool hit_avatar_button = avatar_button() &&
260 avatar_button()->GetMirroredBounds().Intersects(rect);
261 bool hit_new_avatar_button = new_avatar_button() &&
262 new_avatar_button()->GetMirroredBounds().Intersects(rect);
263 return hit_avatar_button || hit_new_avatar_button ||
264 !frame()->client_view()->bounds().Intersects(rect);
265 }
266
256 /////////////////////////////////////////////////////////////////////////////// 267 ///////////////////////////////////////////////////////////////////////////////
257 // GlassBrowserFrameView, views::View overrides: 268 // GlassBrowserFrameView, views::View overrides:
258 269
259 void GlassBrowserFrameView::OnPaint(gfx::Canvas* canvas) { 270 void GlassBrowserFrameView::OnPaint(gfx::Canvas* canvas) {
260 if (browser_view()->IsToolbarVisible() && 271 if (browser_view()->IsToolbarVisible() &&
261 browser_view()->toolbar()->ShouldPaintBackground()) 272 browser_view()->toolbar()->ShouldPaintBackground())
262 PaintToolbarBackground(canvas); 273 PaintToolbarBackground(canvas);
263 if (!frame()->IsMaximized()) 274 if (!frame()->IsMaximized())
264 PaintRestoredClientEdge(canvas); 275 PaintRestoredClientEdge(canvas);
265 } 276 }
266 277
267 void GlassBrowserFrameView::Layout() { 278 void GlassBrowserFrameView::Layout() {
268 if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu()) 279 if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu())
269 LayoutNewStyleAvatar(); 280 LayoutNewStyleAvatar();
270 else 281 else
271 LayoutAvatar(); 282 LayoutAvatar();
272 283
273 LayoutClientView(); 284 LayoutClientView();
274 } 285 }
275 286
276 bool GlassBrowserFrameView::HitTestRect(const gfx::Rect& rect) const {
277 bool hit_avatar_button = avatar_button() &&
278 avatar_button()->GetMirroredBounds().Intersects(rect);
279 bool hit_new_avatar_button = new_avatar_button() &&
280 new_avatar_button()->GetMirroredBounds().Intersects(rect);
281 return hit_avatar_button || hit_new_avatar_button ||
282 !frame()->client_view()->bounds().Intersects(rect);
283 }
284
285 /////////////////////////////////////////////////////////////////////////////// 287 ///////////////////////////////////////////////////////////////////////////////
286 // GlassBrowserFrameView, views::ButtonListener overrides: 288 // GlassBrowserFrameView, views::ButtonListener overrides:
287 void GlassBrowserFrameView::ButtonPressed(views::Button* sender, 289 void GlassBrowserFrameView::ButtonPressed(views::Button* sender,
288 const ui::Event& event) { 290 const ui::Event& event) {
289 if (sender == new_avatar_button()) { 291 if (sender == new_avatar_button()) {
290 browser_view()->ShowAvatarBubbleFromAvatarButton( 292 browser_view()->ShowAvatarBubbleFromAvatarButton(
291 BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT, 293 BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT,
292 signin::ManageAccountsParams()); 294 signin::ManageAccountsParams());
293 } 295 }
294 } 296 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 static bool initialized = false; 588 static bool initialized = false;
587 if (!initialized) { 589 if (!initialized) {
588 for (int i = 0; i < kThrobberIconCount; ++i) { 590 for (int i = 0; i < kThrobberIconCount; ++i) {
589 throbber_icons_[i] = 591 throbber_icons_[i] =
590 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 592 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
591 DCHECK(throbber_icons_[i]); 593 DCHECK(throbber_icons_[i]);
592 } 594 }
593 initialized = true; 595 initialized = true;
594 } 596 }
595 } 597 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698