OLD | NEW |
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/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "app/theme_provider.h" | |
9 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
11 #include "chrome/browser/themes/browser_theme_provider.h" | 10 #include "chrome/browser/themes/browser_theme_provider.h" |
12 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
13 #include "chrome/browser/ui/views/tabs/side_tab_strip.h" | 12 #include "chrome/browser/ui/views/tabs/side_tab_strip.h" |
14 #include "chrome/browser/ui/views/tabs/tab.h" | 13 #include "chrome/browser/ui/views/tabs/tab.h" |
15 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 14 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
16 #include "gfx/canvas_skia.h" | 15 #include "gfx/canvas_skia.h" |
17 #include "gfx/icon_util.h" | 16 #include "gfx/icon_util.h" |
18 #include "grit/app_resources.h" | 17 #include "grit/app_resources.h" |
19 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "ui/base/theme_provider.h" |
20 #include "views/window/client_view.h" | 20 #include "views/window/client_view.h" |
21 #include "views/window/window_resources.h" | 21 #include "views/window/window_resources.h" |
22 | 22 |
23 HICON GlassBrowserFrameView::throbber_icons_[ | 23 HICON GlassBrowserFrameView::throbber_icons_[ |
24 GlassBrowserFrameView::kThrobberIconCount]; | 24 GlassBrowserFrameView::kThrobberIconCount]; |
25 | 25 |
26 namespace { | 26 namespace { |
27 // There are 3 px of client edge drawn inside the outer frame borders. | 27 // There are 3 px of client edge drawn inside the outer frame borders. |
28 const int kNonClientBorderThickness = 3; | 28 const int kNonClientBorderThickness = 3; |
29 // Vertical tabs have 4 px border. | 29 // Vertical tabs have 4 px border. |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). | 236 // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). |
237 if (browser_view_->IsTabStripVisible() && !ignore_vertical_tabs && | 237 if (browser_view_->IsTabStripVisible() && !ignore_vertical_tabs && |
238 browser_view_->UseVerticalTabs()) | 238 browser_view_->UseVerticalTabs()) |
239 return GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION); | 239 return GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION); |
240 return GetSystemMetrics(SM_CYSIZEFRAME) + | 240 return GetSystemMetrics(SM_CYSIZEFRAME) + |
241 ((!restored && browser_view_->IsMaximized()) ? | 241 ((!restored && browser_view_->IsMaximized()) ? |
242 -kTabstripTopShadowThickness : kNonClientRestoredExtraThickness); | 242 -kTabstripTopShadowThickness : kNonClientRestoredExtraThickness); |
243 } | 243 } |
244 | 244 |
245 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { | 245 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { |
246 ThemeProvider* tp = GetThemeProvider(); | 246 ui::ThemeProvider* tp = GetThemeProvider(); |
247 | 247 |
248 gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds()); | 248 gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds()); |
249 gfx::Point toolbar_origin(toolbar_bounds.origin()); | 249 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
250 View::ConvertPointToView(browser_view_, this, &toolbar_origin); | 250 View::ConvertPointToView(browser_view_, this, &toolbar_origin); |
251 toolbar_bounds.set_origin(toolbar_origin); | 251 toolbar_bounds.set_origin(toolbar_origin); |
252 int x = toolbar_bounds.x(); | 252 int x = toolbar_bounds.x(); |
253 int w = toolbar_bounds.width(); | 253 int w = toolbar_bounds.width(); |
254 int left_x = x - kContentEdgeShadowThickness; | 254 int left_x = x - kContentEdgeShadowThickness; |
255 | 255 |
256 SkBitmap* theme_toolbar = tp->GetBitmapNamed(IDR_THEME_TOOLBAR); | 256 SkBitmap* theme_toolbar = tp->GetBitmapNamed(IDR_THEME_TOOLBAR); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // Bias the rounding to select a region that's lower rather than higher, | 353 // Bias the rounding to select a region that's lower rather than higher, |
354 // as the shadows at the image top mean the apparent center is below the | 354 // as the shadows at the image top mean the apparent center is below the |
355 // real center. | 355 // real center. |
356 ((otr_avatar_icon.height() - otr_avatar_bounds_.height()) + 1) / 2, w, h, | 356 ((otr_avatar_icon.height() - otr_avatar_bounds_.height()) + 1) / 2, w, h, |
357 otr_avatar_bounds_.x(), otr_avatar_bounds_.y(), w, h, false); | 357 otr_avatar_bounds_.x(), otr_avatar_bounds_.y(), w, h, false); |
358 | 358 |
359 canvas->Restore(); | 359 canvas->Restore(); |
360 } | 360 } |
361 | 361 |
362 void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { | 362 void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { |
363 ThemeProvider* tp = GetThemeProvider(); | 363 ui::ThemeProvider* tp = GetThemeProvider(); |
364 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); | 364 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); |
365 | 365 |
366 // The client edges start below the toolbar upper corner images regardless | 366 // The client edges start below the toolbar upper corner images regardless |
367 // of how tall the toolbar itself is. | 367 // of how tall the toolbar itself is. |
368 int client_area_top = browser_view_->UseVerticalTabs() ? | 368 int client_area_top = browser_view_->UseVerticalTabs() ? |
369 client_area_bounds.y() : | 369 client_area_bounds.y() : |
370 (frame_->GetWindow()->GetClientView()->y() + | 370 (frame_->GetWindow()->GetClientView()->y() + |
371 browser_view_->GetToolbarBounds().y() + | 371 browser_view_->GetToolbarBounds().y() + |
372 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height()); | 372 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height()); |
373 int client_area_bottom = | 373 int client_area_bottom = |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 static bool initialized = false; | 502 static bool initialized = false; |
503 if (!initialized) { | 503 if (!initialized) { |
504 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); | 504 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); |
505 for (int i = 0; i < kThrobberIconCount; ++i) { | 505 for (int i = 0; i < kThrobberIconCount; ++i) { |
506 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i); | 506 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i); |
507 DCHECK(throbber_icons_[i]); | 507 DCHECK(throbber_icons_[i]); |
508 } | 508 } |
509 initialized = true; | 509 initialized = true; |
510 } | 510 } |
511 } | 511 } |
OLD | NEW |