OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 native_browser_frame_ = | 72 native_browser_frame_ = |
73 NativeBrowserFrameFactory::CreateNativeBrowserFrame(this, browser_view_); | 73 NativeBrowserFrameFactory::CreateNativeBrowserFrame(this, browser_view_); |
74 views::Widget::InitParams params = native_browser_frame_->GetWidgetParams(); | 74 views::Widget::InitParams params = native_browser_frame_->GetWidgetParams(); |
75 params.delegate = browser_view_; | 75 params.delegate = browser_view_; |
76 if (browser_view_->browser()->is_type_tabbed()) { | 76 if (browser_view_->browser()->is_type_tabbed()) { |
77 // Typed panel/popup can only return a size once the widget has been | 77 // Typed panel/popup can only return a size once the widget has been |
78 // created. | 78 // created. |
79 chrome::GetSavedWindowBoundsAndShowState(browser_view_->browser(), | 79 chrome::GetSavedWindowBoundsAndShowState(browser_view_->browser(), |
80 ¶ms.bounds, | 80 ¶ms.bounds, |
81 ¶ms.show_state); | 81 ¶ms.show_state); |
| 82 chrome::GetSavedWindowWorkspace(browser_view_->browser(), |
| 83 ¶ms.workspace); |
82 } | 84 } |
83 | 85 |
84 Init(params); | 86 Init(params); |
85 | 87 |
86 if (!native_browser_frame_->UsesNativeSystemMenu()) { | 88 if (!native_browser_frame_->UsesNativeSystemMenu()) { |
87 DCHECK(non_client_view()); | 89 DCHECK(non_client_view()); |
88 non_client_view()->set_context_menu_controller(this); | 90 non_client_view()->set_context_menu_controller(this); |
89 } | 91 } |
90 | 92 |
91 #if defined(OS_LINUX) | 93 #if defined(OS_LINUX) |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // active on the users desktop, then none of the windows contained in the | 204 // active on the users desktop, then none of the windows contained in the |
203 // remote desktop will be activated. However, NativeWidget::Activate() will | 205 // remote desktop will be activated. However, NativeWidget::Activate() will |
204 // still bring this browser window to the foreground. We explicitly set | 206 // still bring this browser window to the foreground. We explicitly set |
205 // ourselves as the last active browser window to ensure that we get treated | 207 // ourselves as the last active browser window to ensure that we get treated |
206 // as such by the rest of Chrome. | 208 // as such by the rest of Chrome. |
207 BrowserList::SetLastActive(browser_view_->browser()); | 209 BrowserList::SetLastActive(browser_view_->browser()); |
208 } | 210 } |
209 Widget::OnNativeWidgetActivationChanged(active); | 211 Widget::OnNativeWidgetActivationChanged(active); |
210 } | 212 } |
211 | 213 |
| 214 void BrowserFrame::OnNativeWidgetWorkspaceChanged(int workspace_id) { |
| 215 chrome::SaveWindowWorkspace(browser_view_->browser(), workspace_id); |
| 216 Widget::OnNativeWidgetWorkspaceChanged(workspace_id); |
| 217 } |
| 218 |
212 void BrowserFrame::ShowContextMenuForView(views::View* source, | 219 void BrowserFrame::ShowContextMenuForView(views::View* source, |
213 const gfx::Point& p, | 220 const gfx::Point& p, |
214 ui::MenuSourceType source_type) { | 221 ui::MenuSourceType source_type) { |
215 if (chrome::IsRunningInForcedAppMode()) | 222 if (chrome::IsRunningInForcedAppMode()) |
216 return; | 223 return; |
217 | 224 |
218 // Only show context menu if point is in unobscured parts of browser, i.e. | 225 // Only show context menu if point is in unobscured parts of browser, i.e. |
219 // if NonClientHitTest returns : | 226 // if NonClientHitTest returns : |
220 // - HTCAPTION: in title bar or unobscured part of tabstrip | 227 // - HTCAPTION: in title bar or unobscured part of tabstrip |
221 // - HTNOWHERE: as the name implies. | 228 // - HTNOWHERE: as the name implies. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 return menu_model_builder_->menu_model(); | 264 return menu_model_builder_->menu_model(); |
258 } | 265 } |
259 | 266 |
260 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() { | 267 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() { |
261 return browser_frame_view_->avatar_button(); | 268 return browser_frame_view_->avatar_button(); |
262 } | 269 } |
263 | 270 |
264 views::View* BrowserFrame::GetNewAvatarMenuButton() { | 271 views::View* BrowserFrame::GetNewAvatarMenuButton() { |
265 return browser_frame_view_->GetProfileSwitcherView(); | 272 return browser_frame_view_->GetProfileSwitcherView(); |
266 } | 273 } |
OLD | NEW |