OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/browser/browser_theme_provider.h" | 10 #include "chrome/browser/browser_theme_provider.h" |
11 #include "chrome/browser/views/frame/browser_view.h" | 11 #include "chrome/browser/views/frame/browser_view.h" |
12 #include "chrome/browser/views/tabs/tab_strip.h" | 12 #include "chrome/browser/views/tabs/tab_strip_wrapper.h" |
13 #include "grit/app_resources.h" | 13 #include "grit/app_resources.h" |
14 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
15 #include "views/window/client_view.h" | 15 #include "views/window/client_view.h" |
16 #include "views/window/window_resources.h" | 16 #include "views/window/window_resources.h" |
17 | 17 |
18 // static | 18 // static |
19 SkBitmap* GlassBrowserFrameView::distributor_logo_ = NULL; | 19 SkBitmap* GlassBrowserFrameView::distributor_logo_ = NULL; |
20 HICON GlassBrowserFrameView::throbber_icons_[ | 20 HICON GlassBrowserFrameView::throbber_icons_[ |
21 GlassBrowserFrameView::kThrobberIconCount]; | 21 GlassBrowserFrameView::kThrobberIconCount]; |
22 | 22 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 InitThrobberIcons(); | 72 InitThrobberIcons(); |
73 } | 73 } |
74 | 74 |
75 GlassBrowserFrameView::~GlassBrowserFrameView() { | 75 GlassBrowserFrameView::~GlassBrowserFrameView() { |
76 } | 76 } |
77 | 77 |
78 /////////////////////////////////////////////////////////////////////////////// | 78 /////////////////////////////////////////////////////////////////////////////// |
79 // GlassBrowserFrameView, BrowserNonClientFrameView implementation: | 79 // GlassBrowserFrameView, BrowserNonClientFrameView implementation: |
80 | 80 |
81 gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( | 81 gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( |
82 TabStrip* tabstrip) const { | 82 TabStripWrapper* tabstrip) const { |
83 int minimize_button_offset = frame_->GetMinimizeButtonOffset(); | 83 int minimize_button_offset = frame_->GetMinimizeButtonOffset(); |
84 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? | 84 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? |
85 (otr_avatar_bounds_.right() + kOTRSideSpacing) : | 85 (otr_avatar_bounds_.right() + kOTRSideSpacing) : |
86 NonClientBorderThickness(); | 86 NonClientBorderThickness(); |
87 // minimize_button_offset assumes LTR layout since the window controls | 87 // minimize_button_offset assumes LTR layout since the window controls |
88 // themselves are not flipped, so we need to adjust the tabstrip's x | 88 // themselves are not flipped, so we need to adjust the tabstrip's x |
89 // position for them in RTL languages. | 89 // position for them in RTL languages. |
90 if (UILayoutIsRightToLeft()) | 90 if (UILayoutIsRightToLeft()) |
91 tabstrip_x += (width() - minimize_button_offset); | 91 tabstrip_x += (width() - minimize_button_offset); |
92 int tabstrip_width = minimize_button_offset - tabstrip_x - | 92 int tabstrip_width = minimize_button_offset - tabstrip_x - |
93 (frame_->GetWindow()->IsMaximized() ? kNewTabCaptionMaximizedSpacing | 93 (frame_->GetWindow()->IsMaximized() ? kNewTabCaptionMaximizedSpacing |
94 : kNewTabCaptionRestoredSpacing); | 94 : kNewTabCaptionRestoredSpacing); |
95 if (UILayoutIsRightToLeft()) | 95 if (UILayoutIsRightToLeft()) |
96 tabstrip_width += tabstrip_x; | 96 tabstrip_width += tabstrip_x; |
97 return gfx::Rect(tabstrip_x, NonClientTopBorderHeight(), | 97 return gfx::Rect(tabstrip_x, NonClientTopBorderHeight(), |
98 std::max(0, tabstrip_width), tabstrip->GetPreferredHeight()); | 98 std::max(0, tabstrip_width), |
| 99 tabstrip->GetPreferredHeight()); |
99 } | 100 } |
100 | 101 |
101 void GlassBrowserFrameView::UpdateThrobber(bool running) { | 102 void GlassBrowserFrameView::UpdateThrobber(bool running) { |
102 if (throbber_running_) { | 103 if (throbber_running_) { |
103 if (running) { | 104 if (running) { |
104 DisplayNextThrobberFrame(); | 105 DisplayNextThrobberFrame(); |
105 } else { | 106 } else { |
106 StopThrobber(); | 107 StopThrobber(); |
107 } | 108 } |
108 } else if (running) { | 109 } else if (running) { |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 static bool initialized = false; | 437 static bool initialized = false; |
437 if (!initialized) { | 438 if (!initialized) { |
438 #if defined(GOOGLE_CHROME_BUILD) | 439 #if defined(GOOGLE_CHROME_BUILD) |
439 distributor_logo_ = ResourceBundle::GetSharedInstance(). | 440 distributor_logo_ = ResourceBundle::GetSharedInstance(). |
440 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); | 441 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); |
441 #endif | 442 #endif |
442 | 443 |
443 initialized = true; | 444 initialized = true; |
444 } | 445 } |
445 } | 446 } |
OLD | NEW |