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/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // a tab strip until the left end of this window without considering the size | 106 // a tab strip until the left end of this window without considering the size |
107 // of window controls in RTL languages. | 107 // of window controls in RTL languages. |
108 if (base::i18n::IsRTL()) { | 108 if (base::i18n::IsRTL()) { |
109 if (!browser_view()->ShouldShowAvatar() && frame()->IsMaximized()) | 109 if (!browser_view()->ShouldShowAvatar() && frame()->IsMaximized()) |
110 tabstrip_x += avatar_bounds_.x(); | 110 tabstrip_x += avatar_bounds_.x(); |
111 minimize_button_offset = width(); | 111 minimize_button_offset = width(); |
112 } | 112 } |
113 int tabstrip_width = minimize_button_offset - tabstrip_x - | 113 int tabstrip_width = minimize_button_offset - tabstrip_x - |
114 (frame()->IsMaximized() ? | 114 (frame()->IsMaximized() ? |
115 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); | 115 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); |
116 return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false), | 116 return gfx::Rect(tabstrip_x, GetTabStripInsets(false).top, |
117 std::max(0, tabstrip_width), | 117 std::max(0, tabstrip_width), |
118 tabstrip->GetPreferredSize().height()); | 118 tabstrip->GetPreferredSize().height()); |
119 } | 119 } |
120 | 120 |
121 int GlassBrowserFrameView::GetHorizontalTabStripVerticalOffset( | 121 BrowserNonClientFrameView::TabStripInsets |
122 bool restored) const { | 122 GlassBrowserFrameView::GetTabStripInsets(bool restored) const { |
123 return NonClientTopBorderHeight(restored); | 123 // TODO: include OTR and caption. |
| 124 return TabStripInsets(NonClientTopBorderHeight(restored), 0, 0); |
124 } | 125 } |
125 | 126 |
126 void GlassBrowserFrameView::UpdateThrobber(bool running) { | 127 void GlassBrowserFrameView::UpdateThrobber(bool running) { |
127 if (throbber_running_) { | 128 if (throbber_running_) { |
128 if (running) { | 129 if (running) { |
129 DisplayNextThrobberFrame(); | 130 DisplayNextThrobberFrame(); |
130 } else { | 131 } else { |
131 StopThrobber(); | 132 StopThrobber(); |
132 } | 133 } |
133 } else if (running) { | 134 } else if (running) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 gfx::ImageSkia* toolbar_left = tp->GetImageSkiaNamed( | 290 gfx::ImageSkia* toolbar_left = tp->GetImageSkiaNamed( |
290 IDR_CONTENT_TOP_LEFT_CORNER); | 291 IDR_CONTENT_TOP_LEFT_CORNER); |
291 gfx::ImageSkia* toolbar_center = tp->GetImageSkiaNamed( | 292 gfx::ImageSkia* toolbar_center = tp->GetImageSkiaNamed( |
292 IDR_CONTENT_TOP_CENTER); | 293 IDR_CONTENT_TOP_CENTER); |
293 | 294 |
294 // Tile the toolbar image starting at the frame edge on the left and where | 295 // Tile the toolbar image starting at the frame edge on the left and where |
295 // the tabstrip is on the top. | 296 // the tabstrip is on the top. |
296 int y = toolbar_bounds.y(); | 297 int y = toolbar_bounds.y(); |
297 int dest_y = y + (kFrameShadowThickness * 2); | 298 int dest_y = y + (kFrameShadowThickness * 2); |
298 canvas->TileImageInt(*theme_toolbar, x, | 299 canvas->TileImageInt(*theme_toolbar, x, |
299 dest_y - GetHorizontalTabStripVerticalOffset(false), x, | 300 dest_y - GetTabStripInsets(false).top, x, |
300 dest_y, w, theme_toolbar->height()); | 301 dest_y, w, theme_toolbar->height()); |
301 | 302 |
302 // Draw rounded corners for the tab. | 303 // Draw rounded corners for the tab. |
303 gfx::ImageSkia* toolbar_left_mask = | 304 gfx::ImageSkia* toolbar_left_mask = |
304 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK); | 305 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK); |
305 gfx::ImageSkia* toolbar_right_mask = | 306 gfx::ImageSkia* toolbar_right_mask = |
306 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK); | 307 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK); |
307 | 308 |
308 // We mask out the corners by using the DestinationIn transfer mode, | 309 // We mask out the corners by using the DestinationIn transfer mode, |
309 // which keeps the RGB pixels from the destination and the alpha from | 310 // which keeps the RGB pixels from the destination and the alpha from |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); | 407 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); |
407 | 408 |
408 int avatar_x = NonClientBorderThickness() + kAvatarLeftSpacing; | 409 int avatar_x = NonClientBorderThickness() + kAvatarLeftSpacing; |
409 // Move this avatar icon by the size of window controls to prevent it from | 410 // Move this avatar icon by the size of window controls to prevent it from |
410 // being rendered over them in RTL languages. This code also needs to adjust | 411 // being rendered over them in RTL languages. This code also needs to adjust |
411 // the width of a tab strip to avoid decreasing this size twice. (See the | 412 // the width of a tab strip to avoid decreasing this size twice. (See the |
412 // comment in GetBoundsForTabStrip().) | 413 // comment in GetBoundsForTabStrip().) |
413 if (base::i18n::IsRTL()) | 414 if (base::i18n::IsRTL()) |
414 avatar_x += width() - frame()->GetMinimizeButtonOffset(); | 415 avatar_x += width() - frame()->GetMinimizeButtonOffset(); |
415 | 416 |
416 int avatar_bottom = GetHorizontalTabStripVerticalOffset(false) + | 417 int avatar_bottom = GetTabStripInsets(false).top + |
417 browser_view()->GetTabStripHeight() - kAvatarBottomSpacing; | 418 browser_view()->GetTabStripHeight() - kAvatarBottomSpacing; |
418 int avatar_restored_y = avatar_bottom - incognito_icon.height(); | 419 int avatar_restored_y = avatar_bottom - incognito_icon.height(); |
419 int avatar_y = frame()->IsMaximized() ? | 420 int avatar_y = frame()->IsMaximized() ? |
420 (NonClientTopBorderHeight(false) + kTabstripTopShadowThickness) : | 421 (NonClientTopBorderHeight(false) + kTabstripTopShadowThickness) : |
421 avatar_restored_y; | 422 avatar_restored_y; |
422 avatar_bounds_.SetRect(avatar_x, avatar_y, incognito_icon.width(), | 423 avatar_bounds_.SetRect(avatar_x, avatar_y, incognito_icon.width(), |
423 browser_view()->ShouldShowAvatar() ? (avatar_bottom - avatar_y) : 0); | 424 browser_view()->ShouldShowAvatar() ? (avatar_bottom - avatar_y) : 0); |
424 | 425 |
425 if (avatar_button()) | 426 if (avatar_button()) |
426 avatar_button()->SetBoundsRect(avatar_bounds_); | 427 avatar_button()->SetBoundsRect(avatar_bounds_); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 static bool initialized = false; | 515 static bool initialized = false; |
515 if (!initialized) { | 516 if (!initialized) { |
516 for (int i = 0; i < kThrobberIconCount; ++i) { | 517 for (int i = 0; i < kThrobberIconCount; ++i) { |
517 throbber_icons_[i] = | 518 throbber_icons_[i] = |
518 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 519 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
519 DCHECK(throbber_icons_[i]); | 520 DCHECK(throbber_icons_[i]); |
520 } | 521 } |
521 initialized = true; | 522 initialized = true; |
522 } | 523 } |
523 } | 524 } |
OLD | NEW |