| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/frame/glass_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/glass_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "app/theme_provider.h" | 9 #include "app/theme_provider.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
| 11 #include "chrome/browser/browser_theme_provider.h" | 11 #include "chrome/browser/browser_theme_provider.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 int top_height = NonClientTopBorderHeight(); | 145 int top_height = NonClientTopBorderHeight(); |
| 146 int border_thickness = NonClientBorderThickness(); | 146 int border_thickness = NonClientBorderThickness(); |
| 147 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), | 147 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), |
| 148 std::max(0, client_bounds.y() - top_height), | 148 std::max(0, client_bounds.y() - top_height), |
| 149 client_bounds.width() + (2 * border_thickness), | 149 client_bounds.width() + (2 * border_thickness), |
| 150 client_bounds.height() + top_height + border_thickness); | 150 client_bounds.height() + top_height + border_thickness); |
| 151 } | 151 } |
| 152 | 152 |
| 153 gfx::Point GlassBrowserFrameView::GetSystemMenuPoint() const { | |
| 154 views::Window* window = frame_->GetWindow(); | |
| 155 gfx::Point system_menu_point; | |
| 156 if (browser_view_->IsBrowserTypeNormal()) { | |
| 157 // The X coordinate conditional is because in maximized mode the frame edge | |
| 158 // and the client edge are both offscreen, whereas in the opaque frame | |
| 159 // (where we don't do this trick) maximized windows have no client edge and | |
| 160 // only the frame edge is offscreen. | |
| 161 system_menu_point.SetPoint(NonClientBorderThickness() - | |
| 162 ((window->IsMaximized() || window->IsFullscreen()) ? | |
| 163 0 : kClientEdgeThickness), | |
| 164 NonClientTopBorderHeight() + browser_view_->GetTabStripHeight() - | |
| 165 (frame_->GetWindow()->IsFullscreen() ? 0 : kClientEdgeThickness)); | |
| 166 } else { | |
| 167 system_menu_point.SetPoint(0, -kFrameShadowThickness); | |
| 168 } | |
| 169 ConvertPointToScreen(this, &system_menu_point); | |
| 170 return system_menu_point; | |
| 171 } | |
| 172 | |
| 173 int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) { | 153 int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) { |
| 174 // If the browser isn't in normal mode, we haven't customized the frame, so | 154 // If the browser isn't in normal mode, we haven't customized the frame, so |
| 175 // Windows can figure this out. If the point isn't within our bounds, then | 155 // Windows can figure this out. If the point isn't within our bounds, then |
| 176 // it's in the native portion of the frame, so again Windows can figure it | 156 // it's in the native portion of the frame, so again Windows can figure it |
| 177 // out. | 157 // out. |
| 178 if (!browser_view_->IsBrowserTypeNormal() || !bounds().Contains(point)) | 158 if (!browser_view_->IsBrowserTypeNormal() || !bounds().Contains(point)) |
| 179 return HTNOWHERE; | 159 return HTNOWHERE; |
| 180 | 160 |
| 181 int frame_component = | 161 int frame_component = |
| 182 frame_->GetWindow()->GetClientView()->NonClientHitTest(point); | 162 frame_->GetWindow()->GetClientView()->NonClientHitTest(point); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 static bool initialized = false; | 435 static bool initialized = false; |
| 456 if (!initialized) { | 436 if (!initialized) { |
| 457 #if defined(GOOGLE_CHROME_BUILD) | 437 #if defined(GOOGLE_CHROME_BUILD) |
| 458 distributor_logo_ = ResourceBundle::GetSharedInstance(). | 438 distributor_logo_ = ResourceBundle::GetSharedInstance(). |
| 459 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); | 439 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); |
| 460 #endif | 440 #endif |
| 461 | 441 |
| 462 initialized = true; | 442 initialized = true; |
| 463 } | 443 } |
| 464 } | 444 } |
| OLD | NEW |