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

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

Issue 7036014: Consolidate ShouldUseNativeFrame/AlwaysUseNativeFrame/UseNativeFrame spaghetti. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_frame.h" 5 #include "chrome/browser/ui/views/frame/browser_frame.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/themes/theme_service.h" 8 #include "chrome/browser/themes/theme_service.h"
9 #include "chrome/browser/themes/theme_service_factory.h" 9 #include "chrome/browser/themes/theme_service_factory.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 int BrowserFrame::GetHorizontalTabStripVerticalOffset(bool restored) const { 64 int BrowserFrame::GetHorizontalTabStripVerticalOffset(bool restored) const {
65 return browser_frame_view_->GetHorizontalTabStripVerticalOffset(restored); 65 return browser_frame_view_->GetHorizontalTabStripVerticalOffset(restored);
66 } 66 }
67 67
68 void BrowserFrame::UpdateThrobber(bool running) { 68 void BrowserFrame::UpdateThrobber(bool running) {
69 browser_frame_view_->UpdateThrobber(running); 69 browser_frame_view_->UpdateThrobber(running);
70 } 70 }
71 71
72 bool BrowserFrame::AlwaysUseNativeFrame() const {
73 // App panel windows draw their own frame.
74 if (browser_view_->IsBrowserTypePanel())
75 return false;
76
77 // We don't theme popup or app windows, so regardless of whether or not a
78 // theme is active for normal browser windows, we don't want to use the custom
79 // frame for popups/apps.
80 if (!browser_view_->IsBrowserTypeNormal() && ShouldUseNativeFrame())
81 return true;
82
83 // Otherwise, we use the native frame when we're told we should by the theme
84 // provider (e.g. no custom theme is active).
85 return GetThemeProvider()->ShouldUseNativeFrame();
86 }
87
88 views::View* BrowserFrame::GetFrameView() const { 72 views::View* BrowserFrame::GetFrameView() const {
89 return browser_frame_view_; 73 return browser_frame_view_;
90 } 74 }
91 75
92 void BrowserFrame::TabStripDisplayModeChanged() { 76 void BrowserFrame::TabStripDisplayModeChanged() {
93 if (GetRootView()->has_children()) { 77 if (GetRootView()->has_children()) {
94 // Make sure the child of the root view gets Layout again. 78 // Make sure the child of the root view gets Layout again.
95 GetRootView()->GetChildViewAt(0)->InvalidateLayout(); 79 GetRootView()->GetChildViewAt(0)->InvalidateLayout();
96 } 80 }
97 GetRootView()->Layout(); 81 GetRootView()->Layout();
(...skipping 15 matching lines...) Expand all
113 97
114 views::RootView* BrowserFrame::CreateRootView() { 98 views::RootView* BrowserFrame::CreateRootView() {
115 root_view_ = new BrowserRootView( 99 root_view_ = new BrowserRootView(
116 browser_view_, 100 browser_view_,
117 native_browser_frame_->AsNativeWindow()->AsNativeWidget()->GetWidget()); 101 native_browser_frame_->AsNativeWindow()->AsNativeWidget()->GetWidget());
118 return root_view_; 102 return root_view_;
119 } 103 }
120 104
121 views::NonClientFrameView* BrowserFrame::CreateFrameViewForWindow() { 105 views::NonClientFrameView* BrowserFrame::CreateFrameViewForWindow() {
122 #if defined(OS_WIN) 106 #if defined(OS_WIN)
123 if (AlwaysUseNativeFrame()) { 107 if (ShouldUseNativeFrame()) {
124 browser_frame_view_ = new GlassBrowserFrameView(this, browser_view_); 108 browser_frame_view_ = new GlassBrowserFrameView(this, browser_view_);
125 } else { 109 } else {
126 #endif 110 #endif
127 browser_frame_view_ = 111 browser_frame_view_ =
128 browser::CreateBrowserNonClientFrameView(this, browser_view_); 112 browser::CreateBrowserNonClientFrameView(this, browser_view_);
129 #if defined(OS_WIN) 113 #if defined(OS_WIN)
130 } 114 }
131 #endif 115 #endif
132 return browser_frame_view_; 116 return browser_frame_view_;
133 } 117 }
(...skipping 14 matching lines...) Expand all
148 // active on the users desktop, then none of the windows contained in the 132 // active on the users desktop, then none of the windows contained in the
149 // remote desktop will be activated. However, WindowWin::Activate will 133 // remote desktop will be activated. However, WindowWin::Activate will
150 // still bring this browser window to the foreground. We explicitly set 134 // still bring this browser window to the foreground. We explicitly set
151 // ourselves as the last active browser window to ensure that we get treated 135 // ourselves as the last active browser window to ensure that we get treated
152 // as such by the rest of Chrome. 136 // as such by the rest of Chrome.
153 BrowserList::SetLastActive(browser_view_->browser()); 137 BrowserList::SetLastActive(browser_view_->browser());
154 } 138 }
155 Window::OnNativeWindowActivationChanged(active); 139 Window::OnNativeWindowActivationChanged(active);
156 } 140 }
157 141
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame.h ('k') | chrome/browser/ui/views/frame/browser_frame_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698