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

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

Issue 243703003: Removes win8_util (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar Created 6 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/opaque_browser_frame_view_layout.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/profiles/profiles_state.h" 8 #include "chrome/browser/profiles/profiles_state.h"
9 #include "chrome/browser/ui/views/profiles/avatar_label.h" 9 #include "chrome/browser/ui/views/profiles/avatar_label.h"
10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" 10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "components/signin/core/common/profile_management_switches.h" 12 #include "components/signin/core/common/profile_management_switches.h"
13 #include "ui/gfx/font.h" 13 #include "ui/gfx/font.h"
14 #include "ui/views/controls/button/image_button.h" 14 #include "ui/views/controls/button/image_button.h"
15 #include "ui/views/controls/label.h" 15 #include "ui/views/controls/label.h"
16 16
17 #if defined(OS_WIN)
18 #include "win8/util/win8_util.h"
19 #endif // OS_WIN
20
21 namespace { 17 namespace {
22 18
23 // Besides the frame border, there's another 9 px of empty space atop the 19 // Besides the frame border, there's another 9 px of empty space atop the
24 // window in restored mode, to use to drag the window around. 20 // window in restored mode, to use to drag the window around.
25 const int kNonClientRestoredExtraThickness = 9; 21 const int kNonClientRestoredExtraThickness = 9;
26 22
27 // The titlebar never shrinks too short to show the caption button plus some 23 // The titlebar never shrinks too short to show the caption button plus some
28 // padding below it. 24 // padding below it.
29 const int kCaptionButtonHeightWithPadding = 19; 25 const int kCaptionButtonHeightWithPadding = 19;
30 26
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 avatar_label_(NULL), 117 avatar_label_(NULL),
122 avatar_button_(NULL), 118 avatar_button_(NULL),
123 new_avatar_button_(NULL) { 119 new_avatar_button_(NULL) {
124 trailing_buttons_.push_back(views::FRAME_BUTTON_MINIMIZE); 120 trailing_buttons_.push_back(views::FRAME_BUTTON_MINIMIZE);
125 trailing_buttons_.push_back(views::FRAME_BUTTON_MAXIMIZE); 121 trailing_buttons_.push_back(views::FRAME_BUTTON_MAXIMIZE);
126 trailing_buttons_.push_back(views::FRAME_BUTTON_CLOSE); 122 trailing_buttons_.push_back(views::FRAME_BUTTON_CLOSE);
127 } 123 }
128 124
129 OpaqueBrowserFrameViewLayout::~OpaqueBrowserFrameViewLayout() {} 125 OpaqueBrowserFrameViewLayout::~OpaqueBrowserFrameViewLayout() {}
130 126
131 // static
132 bool OpaqueBrowserFrameViewLayout::ShouldAddDefaultCaptionButtons() {
133 #if defined(OS_WIN)
134 return !win8::IsSingleWindowMetroMode();
135 #else
136 return true;
137 #endif
138 }
139
140 void OpaqueBrowserFrameViewLayout::SetButtonOrdering( 127 void OpaqueBrowserFrameViewLayout::SetButtonOrdering(
141 const std::vector<views::FrameButton>& leading_buttons, 128 const std::vector<views::FrameButton>& leading_buttons,
142 const std::vector<views::FrameButton>& trailing_buttons) { 129 const std::vector<views::FrameButton>& trailing_buttons) {
143 leading_buttons_ = leading_buttons; 130 leading_buttons_ = leading_buttons;
144 trailing_buttons_ = trailing_buttons; 131 trailing_buttons_ = trailing_buttons;
145 } 132 }
146 133
147 gfx::Rect OpaqueBrowserFrameViewLayout::GetBoundsForTabStrip( 134 gfx::Rect OpaqueBrowserFrameViewLayout::GetBoundsForTabStrip(
148 const gfx::Size& tabstrip_preferred_size, 135 const gfx::Size& tabstrip_preferred_size,
149 int available_width) const { 136 int available_width) const {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 272 }
286 273
287 int OpaqueBrowserFrameViewLayout::NewTabCaptionSpacing() const { 274 int OpaqueBrowserFrameViewLayout::NewTabCaptionSpacing() const {
288 return has_trailing_buttons_ 275 return has_trailing_buttons_
289 ? (IsTitleBarCondensed() ? kNewTabCaptionCondensedSpacing 276 ? (IsTitleBarCondensed() ? kNewTabCaptionCondensedSpacing
290 : kNewTabCaptionNormalSpacing) 277 : kNewTabCaptionNormalSpacing)
291 : kNewTabNoCaptionButtonsSpacing; 278 : kNewTabNoCaptionButtonsSpacing;
292 } 279 }
293 280
294 void OpaqueBrowserFrameViewLayout::LayoutWindowControls(views::View* host) { 281 void OpaqueBrowserFrameViewLayout::LayoutWindowControls(views::View* host) {
295 if (!ShouldAddDefaultCaptionButtons())
296 return;
297
298 int caption_y = CaptionButtonY(false); 282 int caption_y = CaptionButtonY(false);
299 283
300 // Keep a list of all buttons that we don't show. 284 // Keep a list of all buttons that we don't show.
301 std::vector<views::FrameButton> buttons_not_shown; 285 std::vector<views::FrameButton> buttons_not_shown;
302 buttons_not_shown.push_back(views::FRAME_BUTTON_MAXIMIZE); 286 buttons_not_shown.push_back(views::FRAME_BUTTON_MAXIMIZE);
303 buttons_not_shown.push_back(views::FRAME_BUTTON_MINIMIZE); 287 buttons_not_shown.push_back(views::FRAME_BUTTON_MINIMIZE);
304 buttons_not_shown.push_back(views::FRAME_BUTTON_CLOSE); 288 buttons_not_shown.push_back(views::FRAME_BUTTON_CLOSE);
305 289
306 if (delegate_->ShouldShowCaptionButtons()) { 290 if (delegate_->ShouldShowCaptionButtons()) {
307 for (std::vector<views::FrameButton>::const_iterator it = 291 for (std::vector<views::FrameButton>::const_iterator it =
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 684
701 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, 685 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host,
702 views::View* view) { 686 views::View* view) {
703 SetView(view->id(), view); 687 SetView(view->id(), view);
704 } 688 }
705 689
706 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, 690 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host,
707 views::View* view) { 691 views::View* view) {
708 SetView(view->id(), NULL); 692 SetView(view->id(), NULL);
709 } 693 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view.cc ('k') | chrome/browser/ui/views/hung_renderer_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698