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

Side by Side Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.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/frame/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // is no avatar icon. 107 // is no avatar icon.
108 const int kTabStripIndent = -6; 108 const int kTabStripIndent = -6;
109 109
110 // Converts |bounds| from |src|'s coordinate system to |dst|, and checks if 110 // Converts |bounds| from |src|'s coordinate system to |dst|, and checks if
111 // |pt| is contained within. 111 // |pt| is contained within.
112 bool ConvertedContainsCheck(gfx::Rect bounds, const views::View* src, 112 bool ConvertedContainsCheck(gfx::Rect bounds, const views::View* src,
113 const views::View* dst, const gfx::Point& pt) { 113 const views::View* dst, const gfx::Point& pt) {
114 DCHECK(src); 114 DCHECK(src);
115 DCHECK(dst); 115 DCHECK(dst);
116 gfx::Point origin(bounds.origin()); 116 gfx::Point origin(bounds.origin());
117 views::View::ConvertPointToView(src, dst, &origin); 117 views::View::ConvertPointToTarget(src, dst, &origin);
118 bounds.set_origin(origin); 118 bounds.set_origin(origin);
119 return bounds.Contains(pt); 119 return bounds.Contains(pt);
120 } 120 }
121 121
122 bool ShouldAddDefaultCaptionButtons() { 122 bool ShouldAddDefaultCaptionButtons() {
123 #if defined(OS_WIN) && !defined(USE_AURA) 123 #if defined(OS_WIN) && !defined(USE_AURA)
124 return !base::win::IsMetroProcess(); 124 return !base::win::IsMetroProcess();
125 #endif // OS_WIN 125 #endif // OS_WIN
126 return true; 126 return true;
127 } 127 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // If |rect| does not intersect the bounds of the client area, claim it. 405 // If |rect| does not intersect the bounds of the client area, claim it.
406 bool in_nonclient = NonClientFrameView::HitTestRect(rect); 406 bool in_nonclient = NonClientFrameView::HitTestRect(rect);
407 if (in_nonclient) 407 if (in_nonclient)
408 return in_nonclient; 408 return in_nonclient;
409 409
410 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. 410 // Otherwise claim it only if it's in a non-tab portion of the tabstrip.
411 if (!browser_view()->tabstrip()) 411 if (!browser_view()->tabstrip())
412 return false; 412 return false;
413 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); 413 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
414 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); 414 gfx::Point tabstrip_origin(tabstrip_bounds.origin());
415 View::ConvertPointToView(frame()->client_view(), this, &tabstrip_origin); 415 View::ConvertPointToTarget(frame()->client_view(), this, &tabstrip_origin);
416 tabstrip_bounds.set_origin(tabstrip_origin); 416 tabstrip_bounds.set_origin(tabstrip_origin);
417 if (rect.bottom() > tabstrip_bounds.bottom()) 417 if (rect.bottom() > tabstrip_bounds.bottom())
418 return false; 418 return false;
419 419
420 // We convert from our parent's coordinates since we assume we fill its bounds 420 // We convert from our parent's coordinates since we assume we fill its bounds
421 // completely. We need to do this since we're not a parent of the tabstrip, 421 // completely. We need to do this since we're not a parent of the tabstrip,
422 // meaning ConvertPointToView would otherwise return something bogus. 422 // meaning ConvertPointToTarget would otherwise return something bogus.
423 // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of 423 // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of
424 // its center point once GetEventHandlerForRect() is implemented. 424 // its center point once GetEventHandlerForRect() is implemented.
425 gfx::Point browser_view_point(rect.CenterPoint()); 425 gfx::Point browser_view_point(rect.CenterPoint());
426 View::ConvertPointToView(parent(), browser_view(), &browser_view_point); 426 View::ConvertPointToTarget(parent(), browser_view(), &browser_view_point);
427 return browser_view()->IsPositionInWindowCaption(browser_view_point); 427 return browser_view()->IsPositionInWindowCaption(browser_view_point);
428 } 428 }
429 429
430 void OpaqueBrowserFrameView::GetAccessibleState( 430 void OpaqueBrowserFrameView::GetAccessibleState(
431 ui::AccessibleViewState* state) { 431 ui::AccessibleViewState* state) {
432 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; 432 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR;
433 } 433 }
434 434
435 /////////////////////////////////////////////////////////////////////////////// 435 ///////////////////////////////////////////////////////////////////////////////
436 // OpaqueBrowserFrameView, views::ButtonListener implementation: 436 // OpaqueBrowserFrameView, views::ButtonListener implementation:
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 * So we'd need to sample the background color at the right location and 669 * So we'd need to sample the background color at the right location and
670 * synthesize a good shadow color. */ 670 * synthesize a good shadow color. */
671 } 671 }
672 } 672 }
673 673
674 void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { 674 void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) {
675 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); 675 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds());
676 if (toolbar_bounds.IsEmpty()) 676 if (toolbar_bounds.IsEmpty())
677 return; 677 return;
678 gfx::Point toolbar_origin(toolbar_bounds.origin()); 678 gfx::Point toolbar_origin(toolbar_bounds.origin());
679 ConvertPointToView(browser_view(), this, &toolbar_origin); 679 ConvertPointToTarget(browser_view(), this, &toolbar_origin);
680 toolbar_bounds.set_origin(toolbar_origin); 680 toolbar_bounds.set_origin(toolbar_origin);
681 681
682 int x = toolbar_bounds.x(); 682 int x = toolbar_bounds.x();
683 int w = toolbar_bounds.width(); 683 int w = toolbar_bounds.width();
684 int y = toolbar_bounds.y(); 684 int y = toolbar_bounds.y();
685 int h = toolbar_bounds.height(); 685 int h = toolbar_bounds.height();
686 686
687 // Gross hack: We split the toolbar images into two pieces, since sometimes 687 // Gross hack: We split the toolbar images into two pieces, since sometimes
688 // (popup mode) the toolbar isn't tall enough to show the whole image. The 688 // (popup mode) the toolbar isn't tall enough to show the whole image. The
689 // split happens between the top shadow section and the bottom gradient 689 // split happens between the top shadow section and the bottom gradient
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 1038
1039 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, 1039 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width,
1040 int height) const { 1040 int height) const {
1041 int top_height = NonClientTopBorderHeight(false); 1041 int top_height = NonClientTopBorderHeight(false);
1042 int border_thickness = NonClientBorderThickness(); 1042 int border_thickness = NonClientBorderThickness();
1043 return gfx::Rect(border_thickness, top_height, 1043 return gfx::Rect(border_thickness, top_height,
1044 std::max(0, width - (2 * border_thickness)), 1044 std::max(0, width - (2 * border_thickness)),
1045 std::max(0, height - GetReservedHeight() - 1045 std::max(0, height - GetReservedHeight() -
1046 top_height - border_thickness)); 1046 top_height - border_thickness));
1047 } 1047 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/glass_browser_frame_view.cc ('k') | chrome/browser/ui/views/fullscreen_exit_bubble_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698