Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: chrome/browser/ui/views/frame/glass_browser_frame_view.cc

Issue 10270016: Fix spacing around left tab, increment theme resource ID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 28 matching lines...) Expand all
39 // Besides the frame border, there's another 9 px of empty space atop the 39 // Besides the frame border, there's another 9 px of empty space atop the
40 // window in restored mode, to use to drag the window around. 40 // window in restored mode, to use to drag the window around.
41 const int kNonClientRestoredExtraThickness = 9; 41 const int kNonClientRestoredExtraThickness = 9;
42 // In the window corners, the resize areas don't actually expand bigger, but the 42 // In the window corners, the resize areas don't actually expand bigger, but the
43 // 16 px at the end of the top and bottom edges triggers diagonal resizing. 43 // 16 px at the end of the top and bottom edges triggers diagonal resizing.
44 const int kResizeAreaCornerSize = 16; 44 const int kResizeAreaCornerSize = 16;
45 // The avatar ends 2 px above the bottom of the tabstrip (which, given the 45 // The avatar ends 2 px above the bottom of the tabstrip (which, given the
46 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the 46 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the
47 // user). 47 // user).
48 const int kAvatarBottomSpacing = 2; 48 const int kAvatarBottomSpacing = 2;
49 // There are 2 px on each side of the avatar (between the frame border and 49 // Space between the frame border and the left edge of the avatar.
50 // it on the left, and between it and the tabstrip on the right). 50 const int kAvatarLeftSpacing = 2;
51 const int kAvatarSideSpacing = 2; 51 // Space between the right edge of the avatar and the tabstrip.
52 const int kAvatarRightSpacing = -2;
52 // The content left/right images have a shadow built into them. 53 // The content left/right images have a shadow built into them.
53 const int kContentEdgeShadowThickness = 2; 54 const int kContentEdgeShadowThickness = 2;
54 // The top 3 px of the tabstrip is shadow; in maximized mode we push this off 55 // The top 3 px of the tabstrip is shadow; in maximized mode we push this off
55 // the top of the screen so the tabs appear flush against the screen edge. 56 // the top of the screen so the tabs appear flush against the screen edge.
56 const int kTabstripTopShadowThickness = 3; 57 const int kTabstripTopShadowThickness = 3;
57 // In restored mode, the New Tab button isn't at the same height as the caption 58 // In restored mode, the New Tab button isn't at the same height as the caption
58 // buttons, but the space will look cluttered if it actually slides under them, 59 // buttons, but the space will look cluttered if it actually slides under them,
59 // so we stop it when the gap between the two is down to 5 px. 60 // so we stop it when the gap between the two is down to 5 px.
60 const int kNewTabCaptionRestoredSpacing = 5; 61 const int kNewTabCaptionRestoredSpacing = 5;
61 // In maximized mode, where the New Tab button and the caption buttons are at 62 // In maximized mode, where the New Tab button and the caption buttons are at
62 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid 63 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid
63 // looking too cluttered. 64 // looking too cluttered.
64 const int kNewTabCaptionMaximizedSpacing = 16; 65 const int kNewTabCaptionMaximizedSpacing = 16;
65 // How far to indent the tabstrip from the left side of the screen when there 66 // How far to indent the tabstrip from the left side of the screen when there
66 // is no avatar icon. 67 // is no avatar icon.
67 const int kTabStripIndent = -4; 68 const int kTabStripIndent = -6;
68 } 69 }
69 70
70 /////////////////////////////////////////////////////////////////////////////// 71 ///////////////////////////////////////////////////////////////////////////////
71 // GlassBrowserFrameView, public: 72 // GlassBrowserFrameView, public:
72 73
73 GlassBrowserFrameView::GlassBrowserFrameView(BrowserFrame* frame, 74 GlassBrowserFrameView::GlassBrowserFrameView(BrowserFrame* frame,
74 BrowserView* browser_view) 75 BrowserView* browser_view)
75 : BrowserNonClientFrameView(frame, browser_view), 76 : BrowserNonClientFrameView(frame, browser_view),
76 throbber_running_(false), 77 throbber_running_(false),
77 throbber_frame_(0) { 78 throbber_frame_(0) {
(...skipping 11 matching lines...) Expand all
89 } 90 }
90 91
91 /////////////////////////////////////////////////////////////////////////////// 92 ///////////////////////////////////////////////////////////////////////////////
92 // GlassBrowserFrameView, BrowserNonClientFrameView implementation: 93 // GlassBrowserFrameView, BrowserNonClientFrameView implementation:
93 94
94 gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( 95 gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip(
95 views::View* tabstrip) const { 96 views::View* tabstrip) const {
96 int minimize_button_offset = 97 int minimize_button_offset =
97 std::min(frame()->GetMinimizeButtonOffset(), width()); 98 std::min(frame()->GetMinimizeButtonOffset(), width());
98 int tabstrip_x = browser_view()->ShouldShowAvatar() ? 99 int tabstrip_x = browser_view()->ShouldShowAvatar() ?
99 (avatar_bounds_.right() + kAvatarSideSpacing) : 100 (avatar_bounds_.right() + kAvatarRightSpacing) :
100 NonClientBorderThickness() + kTabStripIndent; 101 NonClientBorderThickness() + kTabStripIndent;
101 // In RTL languages, we have moved an avatar icon left by the size of window 102 // In RTL languages, we have moved an avatar icon left by the size of window
102 // controls to prevent it from being rendered over them. So, we use its x 103 // controls to prevent it from being rendered over them. So, we use its x
103 // position to move this tab strip left when maximized. Also, we can render 104 // position to move this tab strip left when maximized. Also, we can render
104 // a tab strip until the left end of this window without considering the size 105 // a tab strip until the left end of this window without considering the size
105 // of window controls in RTL languages. 106 // of window controls in RTL languages.
106 if (base::i18n::IsRTL()) { 107 if (base::i18n::IsRTL()) {
107 if (!browser_view()->ShouldShowAvatar() && frame()->IsMaximized()) 108 if (!browser_view()->ShouldShowAvatar() && frame()->IsMaximized())
108 tabstrip_x += avatar_bounds_.x(); 109 tabstrip_x += avatar_bounds_.x();
109 minimize_button_offset = width(); 110 minimize_button_offset = width();
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 client_area_bottom + kClientEdgeThickness - client_area_top), 380 client_area_bottom + kClientEdgeThickness - client_area_top),
380 toolbar_color); 381 toolbar_color);
381 } 382 }
382 383
383 void GlassBrowserFrameView::LayoutAvatar() { 384 void GlassBrowserFrameView::LayoutAvatar() {
384 // Even though the avatar is used for both incognito and profiles we always 385 // Even though the avatar is used for both incognito and profiles we always
385 // use the incognito icon to layout the avatar button. The profile icon 386 // use the incognito icon to layout the avatar button. The profile icon
386 // can be customized so we can't depend on its size to perform layout. 387 // can be customized so we can't depend on its size to perform layout.
387 SkBitmap incognito_icon = browser_view()->GetOTRAvatarIcon(); 388 SkBitmap incognito_icon = browser_view()->GetOTRAvatarIcon();
388 389
389 int avatar_x = NonClientBorderThickness() + kAvatarSideSpacing; 390 int avatar_x = NonClientBorderThickness() + kAvatarLeftSpacing;
390 // Move this avatar icon by the size of window controls to prevent it from 391 // Move this avatar icon by the size of window controls to prevent it from
391 // being rendered over them in RTL languages. This code also needs to adjust 392 // being rendered over them in RTL languages. This code also needs to adjust
392 // the width of a tab strip to avoid decreasing this size twice. (See the 393 // the width of a tab strip to avoid decreasing this size twice. (See the
393 // comment in GetBoundsForTabStrip().) 394 // comment in GetBoundsForTabStrip().)
394 if (base::i18n::IsRTL()) 395 if (base::i18n::IsRTL())
395 avatar_x += width() - frame()->GetMinimizeButtonOffset(); 396 avatar_x += width() - frame()->GetMinimizeButtonOffset();
396 397
397 int avatar_bottom = GetHorizontalTabStripVerticalOffset(false) + 398 int avatar_bottom = GetHorizontalTabStripVerticalOffset(false) +
398 browser_view()->GetTabStripHeight() - kAvatarBottomSpacing; 399 browser_view()->GetTabStripHeight() - kAvatarBottomSpacing;
399 int avatar_restored_y = avatar_bottom - incognito_icon.height(); 400 int avatar_restored_y = avatar_bottom - incognito_icon.height();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 static bool initialized = false; 496 static bool initialized = false;
496 if (!initialized) { 497 if (!initialized) {
497 for (int i = 0; i < kThrobberIconCount; ++i) { 498 for (int i = 0; i < kThrobberIconCount; ++i) {
498 throbber_icons_[i] = 499 throbber_icons_[i] =
499 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 500 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
500 DCHECK(throbber_icons_[i]); 501 DCHECK(throbber_icons_[i]);
501 } 502 }
502 initialized = true; 503 initialized = true;
503 } 504 }
504 } 505 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/browser_theme_pack.cc ('k') | chrome/browser/ui/views/frame/opaque_browser_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698