| OLD | NEW |
| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 11 #include "chrome/app/chrome_dll_resource.h" | 11 #include "chrome/app/chrome_dll_resource.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/themes/theme_properties.h" | 13 #include "chrome/browser/themes/theme_properties.h" |
| 14 #include "chrome/browser/ui/views/avatar_menu_button.h" | 14 #include "chrome/browser/ui/views/avatar_menu_button.h" |
| 15 #include "chrome/browser/ui/views/frame/browser_view.h" | 15 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 16 #include "chrome/browser/ui/views/tabs/tab.h" | 16 #include "chrome/browser/ui/views/tabs/tab.h" |
| 17 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 17 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 23 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
| 24 #include "grit/ui_resources.h" | 24 #include "grit/ui_resources.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/resource/resource_bundle_win.h" | 26 #include "ui/base/resource/resource_bundle_win.h" |
| 27 #include "ui/base/theme_provider.h" | 27 #include "ui/base/theme_provider.h" |
| 28 #include "ui/base/win/dpi.h" |
| 28 #include "ui/gfx/canvas.h" | 29 #include "ui/gfx/canvas.h" |
| 29 #include "ui/gfx/icon_util.h" | 30 #include "ui/gfx/icon_util.h" |
| 30 #include "ui/gfx/image/image.h" | 31 #include "ui/gfx/image/image.h" |
| 31 #include "ui/views/win/hwnd_util.h" | 32 #include "ui/views/win/hwnd_util.h" |
| 32 #include "ui/views/window/client_view.h" | 33 #include "ui/views/window/client_view.h" |
| 33 | 34 |
| 34 HICON GlassBrowserFrameView::throbber_icons_[ | 35 HICON GlassBrowserFrameView::throbber_icons_[ |
| 35 GlassBrowserFrameView::kThrobberIconCount]; | 36 GlassBrowserFrameView::kThrobberIconCount]; |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 266 } |
| 266 | 267 |
| 267 int GlassBrowserFrameView::NonClientTopBorderHeight( | 268 int GlassBrowserFrameView::NonClientTopBorderHeight( |
| 268 bool restored) const { | 269 bool restored) const { |
| 269 if (!restored && frame()->IsFullscreen()) | 270 if (!restored && frame()->IsFullscreen()) |
| 270 return 0; | 271 return 0; |
| 271 | 272 |
| 272 // We'd like to use FrameBorderThickness() here, but the maximized Aero glass | 273 // We'd like to use FrameBorderThickness() here, but the maximized Aero glass |
| 273 // frame has a 0 frame border around most edges and a CYSIZEFRAME-thick border | 274 // frame has a 0 frame border around most edges and a CYSIZEFRAME-thick border |
| 274 // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). | 275 // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). |
| 275 return GetSystemMetrics(SM_CYSIZEFRAME) + | 276 return ui::win::GetSystemMetricsInDIP(SM_CYSIZEFRAME) + |
| 276 ((!restored && !frame()->ShouldLeaveOffsetNearTopBorder()) ? | 277 ((!restored && !frame()->ShouldLeaveOffsetNearTopBorder()) ? |
| 277 -kTabstripTopShadowThickness : kNonClientRestoredExtraThickness); | 278 -kTabstripTopShadowThickness : kNonClientRestoredExtraThickness); |
| 278 } | 279 } |
| 279 | 280 |
| 280 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { | 281 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { |
| 281 ui::ThemeProvider* tp = GetThemeProvider(); | 282 ui::ThemeProvider* tp = GetThemeProvider(); |
| 282 | 283 |
| 283 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 284 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
| 284 gfx::Point toolbar_origin(toolbar_bounds.origin()); | 285 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
| 285 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin); | 286 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 static bool initialized = false; | 510 static bool initialized = false; |
| 510 if (!initialized) { | 511 if (!initialized) { |
| 511 for (int i = 0; i < kThrobberIconCount; ++i) { | 512 for (int i = 0; i < kThrobberIconCount; ++i) { |
| 512 throbber_icons_[i] = | 513 throbber_icons_[i] = |
| 513 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 514 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
| 514 DCHECK(throbber_icons_[i]); | 515 DCHECK(throbber_icons_[i]); |
| 515 } | 516 } |
| 516 initialized = true; | 517 initialized = true; |
| 517 } | 518 } |
| 518 } | 519 } |
| OLD | NEW |