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

Side by Side Diff: chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.cc

Issue 10828265: Replace views::LocatedEvent with ui::LocatedEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/ash/browser_non_client_frame_view_ash.h" 5 #include "chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.h"
6 6
7 #include "ash/wm/frame_painter.h" 7 #include "ash/wm/frame_painter.h"
8 #include "ash/wm/workspace/frame_maximize_button.h" 8 #include "ash/wm/workspace/frame_maximize_button.h"
9 #include "chrome/browser/themes/theme_service.h" 9 #include "chrome/browser/themes/theme_service.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 client_bounds); 230 client_bounds);
231 } 231 }
232 232
233 int BrowserNonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) { 233 int BrowserNonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) {
234 int hit_test = frame_painter_->NonClientHitTest(this, point); 234 int hit_test = frame_painter_->NonClientHitTest(this, point);
235 // When the window is restored we want a large click target above the tabs 235 // When the window is restored we want a large click target above the tabs
236 // to drag the window, so redirect clicks in the tab's shadow to caption. 236 // to drag the window, so redirect clicks in the tab's shadow to caption.
237 if (hit_test == HTCLIENT && !frame()->IsMaximized()) { 237 if (hit_test == HTCLIENT && !frame()->IsMaximized()) {
238 // Convert point to client coordinates. 238 // Convert point to client coordinates.
239 gfx::Point client_point(point); 239 gfx::Point client_point(point);
240 View::ConvertPointToView(this, frame()->client_view(), &client_point); 240 View::ConvertPointToTarget(this, frame()->client_view(), &client_point);
241 // Report hits in shadow at top of tabstrip as caption. 241 // Report hits in shadow at top of tabstrip as caption.
242 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 242 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
243 if (client_point.y() < tabstrip_bounds.y() + tab_shadow_height()) 243 if (client_point.y() < tabstrip_bounds.y() + tab_shadow_height())
244 hit_test = HTCAPTION; 244 hit_test = HTCAPTION;
245 } 245 }
246 return hit_test; 246 return hit_test;
247 } 247 }
248 248
249 void BrowserNonClientFrameViewAsh::GetWindowMask(const gfx::Size& size, 249 void BrowserNonClientFrameViewAsh::GetWindowMask(const gfx::Size& size,
250 gfx::Path* window_mask) { 250 gfx::Path* window_mask) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const { 335 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const {
336 // If the rect is outside the bounds of the client area, claim it. 336 // If the rect is outside the bounds of the client area, claim it.
337 if (NonClientFrameView::HitTestRect(rect)) 337 if (NonClientFrameView::HitTestRect(rect))
338 return true; 338 return true;
339 339
340 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. 340 // Otherwise claim it only if it's in a non-tab portion of the tabstrip.
341 if (!browser_view()->tabstrip()) 341 if (!browser_view()->tabstrip())
342 return false; 342 return false;
343 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 343 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
344 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); 344 gfx::Point tabstrip_origin(tabstrip_bounds.origin());
345 View::ConvertPointToView(frame()->client_view(), this, &tabstrip_origin); 345 View::ConvertPointToTarget(frame()->client_view(), this, &tabstrip_origin);
346 tabstrip_bounds.set_origin(tabstrip_origin); 346 tabstrip_bounds.set_origin(tabstrip_origin);
347 if (rect.bottom() > tabstrip_bounds.bottom()) 347 if (rect.bottom() > tabstrip_bounds.bottom())
348 return false; 348 return false;
349 349
350 // We convert from our parent's coordinates since we assume we fill its bounds 350 // We convert from our parent's coordinates since we assume we fill its bounds
351 // completely. We need to do this since we're not a parent of the tabstrip, 351 // completely. We need to do this since we're not a parent of the tabstrip,
352 // meaning ConvertPointToView would otherwise return something bogus. 352 // meaning ConvertPointToTarget would otherwise return something bogus.
353 // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of 353 // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of
354 // its center point once GetEventHandlerForRect() is implemented. 354 // its center point once GetEventHandlerForRect() is implemented.
355 gfx::Point browser_view_point(rect.CenterPoint()); 355 gfx::Point browser_view_point(rect.CenterPoint());
356 View::ConvertPointToView(parent(), browser_view(), &browser_view_point); 356 View::ConvertPointToTarget(parent(), browser_view(), &browser_view_point);
357 return browser_view()->IsPositionInWindowCaption(browser_view_point); 357 return browser_view()->IsPositionInWindowCaption(browser_view_point);
358 } 358 }
359 359
360 void BrowserNonClientFrameViewAsh::GetAccessibleState( 360 void BrowserNonClientFrameViewAsh::GetAccessibleState(
361 ui::AccessibleViewState* state) { 361 ui::AccessibleViewState* state) {
362 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; 362 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR;
363 } 363 }
364 364
365 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() { 365 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() {
366 return frame_painter_->GetMinimumSize(this); 366 return frame_painter_->GetMinimumSize(this);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 avatar_button()->SetBoundsRect(avatar_bounds); 490 avatar_button()->SetBoundsRect(avatar_bounds);
491 } 491 }
492 492
493 void BrowserNonClientFrameViewAsh::PaintToolbarBackground( 493 void BrowserNonClientFrameViewAsh::PaintToolbarBackground(
494 gfx::Canvas* canvas, 494 gfx::Canvas* canvas,
495 chrome::search::Mode::Type mode) { 495 chrome::search::Mode::Type mode) {
496 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); 496 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds());
497 if (toolbar_bounds.IsEmpty()) 497 if (toolbar_bounds.IsEmpty())
498 return; 498 return;
499 gfx::Point toolbar_origin(toolbar_bounds.origin()); 499 gfx::Point toolbar_origin(toolbar_bounds.origin());
500 ConvertPointToView(browser_view(), this, &toolbar_origin); 500 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin);
501 toolbar_bounds.set_origin(toolbar_origin); 501 toolbar_bounds.set_origin(toolbar_origin);
502 502
503 int x = toolbar_bounds.x(); 503 int x = toolbar_bounds.x();
504 int w = toolbar_bounds.width(); 504 int w = toolbar_bounds.width();
505 int y = toolbar_bounds.y(); 505 int y = toolbar_bounds.y();
506 int h = toolbar_bounds.height(); 506 int h = toolbar_bounds.height();
507 507
508 // Gross hack: We split the toolbar images into two pieces, since sometimes 508 // Gross hack: We split the toolbar images into two pieces, since sometimes
509 // (popup mode) the toolbar isn't tall enough to show the whole image. The 509 // (popup mode) the toolbar isn't tall enough to show the whole image. The
510 // split happens between the top shadow section and the bottom gradient 510 // split happens between the top shadow section and the bottom gradient
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const { 606 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const {
607 ui::ThemeProvider* tp = GetThemeProvider(); 607 ui::ThemeProvider* tp = GetThemeProvider();
608 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 608 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
609 browser_view()->IsBrowserTypeNormal() && 609 browser_view()->IsBrowserTypeNormal() &&
610 !browser_view()->IsOffTheRecord()) { 610 !browser_view()->IsOffTheRecord()) {
611 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ? 611 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ?
612 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); 612 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE);
613 } 613 }
614 return NULL; 614 return NULL;
615 } 615 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698