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

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

Issue 6334152: Clean up RTL methods.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/app_panel_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/app_panel_browser_frame_view.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/tab_contents/tab_contents.h" 9 #include "chrome/browser/tab_contents/tab_contents.h"
10 #include "chrome/browser/ui/views/frame/browser_frame.h" 10 #include "chrome/browser/ui/views/frame/browser_frame.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 int frame_component = 149 int frame_component =
150 frame_->GetWindow()->GetClientView()->NonClientHitTest(point); 150 frame_->GetWindow()->GetClientView()->NonClientHitTest(point);
151 151
152 // See if we're in the sysmenu region. (We check the ClientView first to be 152 // See if we're in the sysmenu region. (We check the ClientView first to be
153 // consistent with OpaqueBrowserFrameView; it's not really necessary here.) 153 // consistent with OpaqueBrowserFrameView; it's not really necessary here.)
154 gfx::Rect sysmenu_rect(IconBounds()); 154 gfx::Rect sysmenu_rect(IconBounds());
155 // In maximized mode we extend the rect to the screen corner to take advantage 155 // In maximized mode we extend the rect to the screen corner to take advantage
156 // of Fitts' Law. 156 // of Fitts' Law.
157 if (frame_->GetWindow()->IsMaximized()) 157 if (frame_->GetWindow()->IsMaximized())
158 sysmenu_rect.SetRect(0, 0, sysmenu_rect.right(), sysmenu_rect.bottom()); 158 sysmenu_rect.SetRect(0, 0, sysmenu_rect.right(), sysmenu_rect.bottom());
159 sysmenu_rect.set_x(MirroredLeftPointForRect(sysmenu_rect)); 159 sysmenu_rect.set_x(GetMirroredXForRect(sysmenu_rect));
160 if (sysmenu_rect.Contains(point)) 160 if (sysmenu_rect.Contains(point))
161 return (frame_component == HTCLIENT) ? HTCLIENT : HTSYSMENU; 161 return (frame_component == HTCLIENT) ? HTCLIENT : HTSYSMENU;
162 162
163 if (frame_component != HTNOWHERE) 163 if (frame_component != HTNOWHERE)
164 return frame_component; 164 return frame_component;
165 165
166 // Then see if the point is within any of the window controls. 166 // Then see if the point is within any of the window controls.
167 if (close_button_->IsVisible() && 167 if (close_button_->IsVisible() &&
168 close_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION).Contains(point)) 168 close_button_->GetMirroredBounds().Contains(point))
169 return HTCLOSE; 169 return HTCLOSE;
170 170
171 int window_component = GetHTComponentForFrame(point, 171 int window_component = GetHTComponentForFrame(point,
172 NonClientBorderThickness(), NonClientBorderThickness(), 172 NonClientBorderThickness(), NonClientBorderThickness(),
173 kResizeAreaCornerSize, kResizeAreaCornerSize, 173 kResizeAreaCornerSize, kResizeAreaCornerSize,
174 frame_->GetWindow()->GetDelegate()->CanResize()); 174 frame_->GetWindow()->GetDelegate()->CanResize());
175 // Fall back to the caption if no other component matches. 175 // Fall back to the caption if no other component matches.
176 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; 176 return (window_component == HTNOWHERE) ? HTCAPTION : window_component;
177 } 177 }
178 178
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 int edge_height = titlebar_bottom->height() - kClientEdgeThickness; 397 int edge_height = titlebar_bottom->height() - kClientEdgeThickness;
398 canvas->TileImageInt(*titlebar_bottom, 0, 398 canvas->TileImageInt(*titlebar_bottom, 0,
399 frame_->GetWindow()->GetClientView()->y() - edge_height, 399 frame_->GetWindow()->GetClientView()->y() - edge_height,
400 width(), edge_height); 400 width(), edge_height);
401 } 401 }
402 402
403 void AppPanelBrowserFrameView::PaintTitleBar(gfx::Canvas* canvas) { 403 void AppPanelBrowserFrameView::PaintTitleBar(gfx::Canvas* canvas) {
404 // The window icon is painted by the TabIconView. 404 // The window icon is painted by the TabIconView.
405 views::WindowDelegate* d = frame_->GetWindow()->GetDelegate(); 405 views::WindowDelegate* d = frame_->GetWindow()->GetDelegate();
406 canvas->DrawStringInt(d->GetWindowTitle(), BrowserFrame::GetTitleFont(), 406 canvas->DrawStringInt(d->GetWindowTitle(), BrowserFrame::GetTitleFont(),
407 SK_ColorBLACK, MirroredLeftPointForRect(title_bounds_), title_bounds_.y(), 407 SK_ColorBLACK, GetMirroredXForRect(title_bounds_), title_bounds_.y(),
408 title_bounds_.width(), title_bounds_.height()); 408 title_bounds_.width(), title_bounds_.height());
409 } 409 }
410 410
411 void AppPanelBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { 411 void AppPanelBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) {
412 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); 412 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height());
413 int client_area_top = client_area_bounds.y(); 413 int client_area_top = client_area_bounds.y();
414 414
415 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 415 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
416 SkBitmap* top_left = rb.GetBitmapNamed(IDR_APP_TOP_LEFT); 416 SkBitmap* top_left = rb.GetBitmapNamed(IDR_APP_TOP_LEFT);
417 SkBitmap* top = rb.GetBitmapNamed(IDR_APP_TOP_CENTER); 417 SkBitmap* top = rb.GetBitmapNamed(IDR_APP_TOP_CENTER);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 } 498 }
499 499
500 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, 500 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width,
501 int height) const { 501 int height) const {
502 int top_height = NonClientTopBorderHeight(); 502 int top_height = NonClientTopBorderHeight();
503 int border_thickness = NonClientBorderThickness(); 503 int border_thickness = NonClientBorderThickness();
504 return gfx::Rect(border_thickness, top_height, 504 return gfx::Rect(border_thickness, top_height,
505 std::max(0, width - (2 * border_thickness)), 505 std::max(0, width - (2 * border_thickness)),
506 std::max(0, height - top_height - border_thickness)); 506 std::max(0, height - top_height - border_thickness));
507 } 507 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698