OLD | NEW |
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 Loading... |
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 |
72 views::View* BrowserFrame::GetFrameView() const { | 88 views::View* BrowserFrame::GetFrameView() const { |
73 return browser_frame_view_; | 89 return browser_frame_view_; |
74 } | 90 } |
75 | 91 |
76 void BrowserFrame::TabStripDisplayModeChanged() { | 92 void BrowserFrame::TabStripDisplayModeChanged() { |
77 if (GetRootView()->has_children()) { | 93 if (GetRootView()->has_children()) { |
78 // Make sure the child of the root view gets Layout again. | 94 // Make sure the child of the root view gets Layout again. |
79 GetRootView()->GetChildViewAt(0)->InvalidateLayout(); | 95 GetRootView()->GetChildViewAt(0)->InvalidateLayout(); |
80 } | 96 } |
81 GetRootView()->Layout(); | 97 GetRootView()->Layout(); |
(...skipping 15 matching lines...) Expand all Loading... |
97 | 113 |
98 views::RootView* BrowserFrame::CreateRootView() { | 114 views::RootView* BrowserFrame::CreateRootView() { |
99 root_view_ = new BrowserRootView( | 115 root_view_ = new BrowserRootView( |
100 browser_view_, | 116 browser_view_, |
101 native_browser_frame_->AsNativeWindow()->AsNativeWidget()->GetWidget()); | 117 native_browser_frame_->AsNativeWindow()->AsNativeWidget()->GetWidget()); |
102 return root_view_; | 118 return root_view_; |
103 } | 119 } |
104 | 120 |
105 views::NonClientFrameView* BrowserFrame::CreateFrameViewForWindow() { | 121 views::NonClientFrameView* BrowserFrame::CreateFrameViewForWindow() { |
106 #if defined(OS_WIN) | 122 #if defined(OS_WIN) |
107 if (ShouldUseNativeFrame()) { | 123 if (AlwaysUseNativeFrame()) { |
108 browser_frame_view_ = new GlassBrowserFrameView(this, browser_view_); | 124 browser_frame_view_ = new GlassBrowserFrameView(this, browser_view_); |
109 } else { | 125 } else { |
110 #endif | 126 #endif |
111 browser_frame_view_ = | 127 browser_frame_view_ = |
112 browser::CreateBrowserNonClientFrameView(this, browser_view_); | 128 browser::CreateBrowserNonClientFrameView(this, browser_view_); |
113 #if defined(OS_WIN) | 129 #if defined(OS_WIN) |
114 } | 130 } |
115 #endif | 131 #endif |
116 return browser_frame_view_; | 132 return browser_frame_view_; |
117 } | 133 } |
(...skipping 14 matching lines...) Expand all Loading... |
132 // active on the users desktop, then none of the windows contained in the | 148 // active on the users desktop, then none of the windows contained in the |
133 // remote desktop will be activated. However, WindowWin::Activate will | 149 // remote desktop will be activated. However, WindowWin::Activate will |
134 // still bring this browser window to the foreground. We explicitly set | 150 // still bring this browser window to the foreground. We explicitly set |
135 // ourselves as the last active browser window to ensure that we get treated | 151 // ourselves as the last active browser window to ensure that we get treated |
136 // as such by the rest of Chrome. | 152 // as such by the rest of Chrome. |
137 BrowserList::SetLastActive(browser_view_->browser()); | 153 BrowserList::SetLastActive(browser_view_->browser()); |
138 } | 154 } |
139 Window::OnNativeWindowActivationChanged(active); | 155 Window::OnNativeWindowActivationChanged(active); |
140 } | 156 } |
141 | 157 |
OLD | NEW |