OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/opaque_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/opaque_browser_frame_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.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 "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // buttons, but the space will look cluttered if it actually slides under them, | 88 // buttons, but the space will look cluttered if it actually slides under them, |
89 // so we stop it when the gap between the two is down to 5 px. | 89 // so we stop it when the gap between the two is down to 5 px. |
90 const int kNewTabCaptionRestoredSpacing = 5; | 90 const int kNewTabCaptionRestoredSpacing = 5; |
91 // In maximized mode, where the New Tab button and the caption buttons are at | 91 // In maximized mode, where the New Tab button and the caption buttons are at |
92 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid | 92 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid |
93 // looking too cluttered. | 93 // looking too cluttered. |
94 const int kNewTabCaptionMaximizedSpacing = 16; | 94 const int kNewTabCaptionMaximizedSpacing = 16; |
95 // How far to indent the tabstrip from the left side of the screen when there | 95 // How far to indent the tabstrip from the left side of the screen when there |
96 // is no OTR icon. | 96 // is no OTR icon. |
97 const int kTabStripIndent = 1; | 97 const int kTabStripIndent = 1; |
98 // Spacing between extension app icon/title and tab strip. | |
99 const int kExtensionAppTabStripLeftSpacing = 10; | |
100 // Padding between the caption and start of vertical tabs. | 98 // Padding between the caption and start of vertical tabs. |
101 const int kVerticalTabPadding = 6; | 99 const int kVerticalTabPadding = 6; |
102 // Inset from the top of the toolbar/tabstrip to the shadow. Used only for | 100 // Inset from the top of the toolbar/tabstrip to the shadow. Used only for |
103 // vertical tabs. | 101 // vertical tabs. |
104 const int kVerticalTabBorderInset = 3; | 102 const int kVerticalTabBorderInset = 3; |
105 } | 103 } |
106 | 104 |
107 /////////////////////////////////////////////////////////////////////////////// | 105 /////////////////////////////////////////////////////////////////////////////// |
108 // OpaqueBrowserFrameView, public: | 106 // OpaqueBrowserFrameView, public: |
109 | 107 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 tabstrip_y += kNonClientRestoredExtraThickness; | 209 tabstrip_y += kNonClientRestoredExtraThickness; |
212 } | 210 } |
213 | 211 |
214 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? | 212 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? |
215 (otr_avatar_icon_->bounds().right() + kOTRSideSpacing) : | 213 (otr_avatar_icon_->bounds().right() + kOTRSideSpacing) : |
216 NonClientBorderThickness() + kTabStripIndent; | 214 NonClientBorderThickness() + kTabStripIndent; |
217 | 215 |
218 int tabstrip_width = minimize_button_->x() - tabstrip_x - | 216 int tabstrip_width = minimize_button_->x() - tabstrip_x - |
219 (frame_->GetWindow()->IsMaximized() ? | 217 (frame_->GetWindow()->IsMaximized() ? |
220 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); | 218 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); |
221 | |
222 if (browser_view_->browser()->type() == Browser::TYPE_EXTENSION_APP) { | |
223 int tabstrip_offset = browser_view_->extension_app_title()->x() + | |
224 browser_view_->extension_app_title()->width() + | |
225 kExtensionAppTabStripLeftSpacing; | |
226 | |
227 tabstrip_x += tabstrip_offset; | |
228 tabstrip_width -= tabstrip_offset; | |
229 } | |
230 | |
231 return gfx::Rect(tabstrip_x, tabstrip_y, | 219 return gfx::Rect(tabstrip_x, tabstrip_y, |
232 std::max(0, tabstrip_width), | 220 std::max(0, tabstrip_width), |
233 tabstrip->GetPreferredHeight()); | 221 tabstrip->GetPreferredHeight()); |
234 } | 222 } |
235 | 223 |
236 void OpaqueBrowserFrameView::UpdateThrobber(bool running) { | 224 void OpaqueBrowserFrameView::UpdateThrobber(bool running) { |
237 if (window_icon_) | 225 if (window_icon_) |
238 window_icon_->Update(); | 226 window_icon_->Update(); |
239 } | 227 } |
240 | 228 |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 // static | 1071 // static |
1084 gfx::Rect OpaqueBrowserFrameView::GetViewBounds(views::View* src, | 1072 gfx::Rect OpaqueBrowserFrameView::GetViewBounds(views::View* src, |
1085 views::View* dst) { | 1073 views::View* dst) { |
1086 gfx::Rect bounds(src->bounds()); | 1074 gfx::Rect bounds(src->bounds()); |
1087 | 1075 |
1088 gfx::Point origin_in_dst(bounds.origin()); | 1076 gfx::Point origin_in_dst(bounds.origin()); |
1089 View::ConvertPointToView(src->GetParent(), dst, &origin_in_dst); | 1077 View::ConvertPointToView(src->GetParent(), dst, &origin_in_dst); |
1090 bounds.set_origin(origin_in_dst); | 1078 bounds.set_origin(origin_in_dst); |
1091 return bounds; | 1079 return bounds; |
1092 } | 1080 } |
OLD | NEW |