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

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

Issue 146343002: Refactor OpaqueBrowserFrameView; reduce uses of kUseSystemTitleBar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests. Created 6 years, 10 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/avatar_label.h" 9 #include "chrome/browser/ui/views/avatar_label.h"
10 #include "chrome/browser/ui/views/avatar_menu_button.h" 10 #include "chrome/browser/ui/views/avatar_menu_button.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 int width, 261 int width,
262 int height) const { 262 int height) const {
263 int top_height = NonClientTopBorderHeight(false); 263 int top_height = NonClientTopBorderHeight(false);
264 int border_thickness = NonClientBorderThickness(); 264 int border_thickness = NonClientBorderThickness();
265 return gfx::Rect(border_thickness, top_height, 265 return gfx::Rect(border_thickness, top_height,
266 std::max(0, width - (2 * border_thickness)), 266 std::max(0, width - (2 * border_thickness)),
267 std::max(0, height - top_height - border_thickness)); 267 std::max(0, height - top_height - border_thickness));
268 } 268 }
269 269
270 bool OpaqueBrowserFrameViewLayout::IsTitleBarCondensed() const { 270 bool OpaqueBrowserFrameViewLayout::IsTitleBarCondensed() const {
271 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 271 // If there are no caption buttons, there is no need to have an uncondensed
272 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseSystemTitleBar)) 272 // title bar. If the window is maximized, the title bar is condensed
273 return true; 273 // regardless of whether there are caption buttons.
274 #endif 274 return !delegate_->ShouldShowCaptionButtons() || delegate_->IsMaximized();
275
276 return delegate_->IsMaximized();
277 } 275 }
278 276
279 /////////////////////////////////////////////////////////////////////////////// 277 ///////////////////////////////////////////////////////////////////////////////
280 // OpaqueBrowserFrameView, private: 278 // OpaqueBrowserFrameView, private:
281 279
282 bool OpaqueBrowserFrameViewLayout::ShouldAvatarBeOnRight() const { 280 bool OpaqueBrowserFrameViewLayout::ShouldAvatarBeOnRight() const {
283 // The avatar should be shown either on the end of the left or the beginning 281 // The avatar should be shown either on the end of the left or the beginning
284 // of the right depending on which side has fewer buttons. 282 // of the right depending on which side has fewer buttons.
285 return trailing_buttons_.size() < leading_buttons_.size(); 283 return trailing_buttons_.size() < leading_buttons_.size();
286 } 284 }
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 700
703 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, 701 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host,
704 views::View* view) { 702 views::View* view) {
705 SetView(view->id(), view); 703 SetView(view->id(), view);
706 } 704 }
707 705
708 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, 706 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host,
709 views::View* view) { 707 views::View* view) {
710 SetView(view->id(), NULL); 708 SetView(view->id(), NULL);
711 } 709 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698