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

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

Issue 1927203003: Add support for X11 workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed GetSavedWindowWorkspace, put command line code into browser_frame.cc Created 4 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
OLDNEW
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/command_line.h"
9 #include "base/debug/leak_annotations.h" 10 #include "base/debug/leak_annotations.h"
10 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
11 #include "build/build_config.h" 12 #include "build/build_config.h"
12 #include "chrome/browser/app_mode/app_mode_utils.h" 13 #include "chrome/browser/app_mode/app_mode_utils.h"
13 #include "chrome/browser/themes/theme_service.h" 14 #include "chrome/browser/themes/theme_service.h"
14 #include "chrome/browser/themes/theme_service_factory.h" 15 #include "chrome/browser/themes/theme_service_factory.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
17 #include "chrome/browser/ui/browser_window_state.h" 18 #include "chrome/browser/ui/browser_window_state.h"
18 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" 19 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
19 #include "chrome/browser/ui/views/frame/browser_root_view.h" 20 #include "chrome/browser/ui/views/frame/browser_root_view.h"
20 #include "chrome/browser/ui/views/frame/browser_view.h" 21 #include "chrome/browser/ui/views/frame/browser_view.h"
21 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 22 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
22 #include "chrome/browser/ui/views/frame/native_browser_frame.h" 23 #include "chrome/browser/ui/views/frame/native_browser_frame.h"
23 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" 24 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h"
24 #include "chrome/browser/ui/views/frame/system_menu_model_builder.h" 25 #include "chrome/browser/ui/views/frame/system_menu_model_builder.h"
25 #include "chrome/browser/ui/views/frame/top_container_view.h" 26 #include "chrome/browser/ui/views/frame/top_container_view.h"
27 #include "chrome/common/chrome_switches.h"
26 #include "ui/base/hit_test.h" 28 #include "ui/base/hit_test.h"
27 #include "ui/events/event_handler.h" 29 #include "ui/events/event_handler.h"
28 #include "ui/gfx/font_list.h" 30 #include "ui/gfx/font_list.h"
29 #include "ui/gfx/screen.h" 31 #include "ui/gfx/screen.h"
30 #include "ui/views/controls/menu/menu_runner.h" 32 #include "ui/views/controls/menu/menu_runner.h"
31 #include "ui/views/widget/native_widget.h" 33 #include "ui/views/widget/native_widget.h"
32 34
33 #if defined(OS_CHROMEOS) 35 #if defined(OS_CHROMEOS)
34 #include "ash/session/session_state_delegate.h" 36 #include "ash/session/session_state_delegate.h"
35 #include "ash/shell.h" 37 #include "ash/shell.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 native_browser_frame_ = 74 native_browser_frame_ =
73 NativeBrowserFrameFactory::CreateNativeBrowserFrame(this, browser_view_); 75 NativeBrowserFrameFactory::CreateNativeBrowserFrame(this, browser_view_);
74 views::Widget::InitParams params = native_browser_frame_->GetWidgetParams(); 76 views::Widget::InitParams params = native_browser_frame_->GetWidgetParams();
75 params.delegate = browser_view_; 77 params.delegate = browser_view_;
76 if (browser_view_->browser()->is_type_tabbed()) { 78 if (browser_view_->browser()->is_type_tabbed()) {
77 // Typed panel/popup can only return a size once the widget has been 79 // Typed panel/popup can only return a size once the widget has been
78 // created. 80 // created.
79 chrome::GetSavedWindowBoundsAndShowState(browser_view_->browser(), 81 chrome::GetSavedWindowBoundsAndShowState(browser_view_->browser(),
80 &params.bounds, 82 &params.bounds,
81 &params.show_state); 83 &params.show_state);
84
85 params.workspace = browser_view_->browser()->initial_workspace();
86 const base::CommandLine& parsed_command_line =
87 *base::CommandLine::ForCurrentProcess();
88
89 if (parsed_command_line.HasSwitch(switches::kWindowWorkspace)) {
90 params.workspace =
91 parsed_command_line.GetSwitchValueASCII(switches::kWindowWorkspace);
92 }
82 } 93 }
83 94
84 Init(params); 95 Init(params);
85 96
86 if (!native_browser_frame_->UsesNativeSystemMenu()) { 97 if (!native_browser_frame_->UsesNativeSystemMenu()) {
87 DCHECK(non_client_view()); 98 DCHECK(non_client_view());
88 non_client_view()->set_context_menu_controller(this); 99 non_client_view()->set_context_menu_controller(this);
89 } 100 }
90 101
91 #if defined(OS_LINUX) 102 #if defined(OS_LINUX)
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // active on the users desktop, then none of the windows contained in the 213 // active on the users desktop, then none of the windows contained in the
203 // remote desktop will be activated. However, NativeWidget::Activate() will 214 // remote desktop will be activated. However, NativeWidget::Activate() will
204 // still bring this browser window to the foreground. We explicitly set 215 // 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 216 // ourselves as the last active browser window to ensure that we get treated
206 // as such by the rest of Chrome. 217 // as such by the rest of Chrome.
207 BrowserList::SetLastActive(browser_view_->browser()); 218 BrowserList::SetLastActive(browser_view_->browser());
208 } 219 }
209 Widget::OnNativeWidgetActivationChanged(active); 220 Widget::OnNativeWidgetActivationChanged(active);
210 } 221 }
211 222
223 void BrowserFrame::OnNativeWidgetWorkspaceChanged() {
224 chrome::SaveWindowWorkspace(browser_view_->browser(), GetWorkspace());
225 Widget::OnNativeWidgetWorkspaceChanged();
226 }
227
212 void BrowserFrame::ShowContextMenuForView(views::View* source, 228 void BrowserFrame::ShowContextMenuForView(views::View* source,
213 const gfx::Point& p, 229 const gfx::Point& p,
214 ui::MenuSourceType source_type) { 230 ui::MenuSourceType source_type) {
215 if (chrome::IsRunningInForcedAppMode()) 231 if (chrome::IsRunningInForcedAppMode())
216 return; 232 return;
217 233
218 // Only show context menu if point is in unobscured parts of browser, i.e. 234 // Only show context menu if point is in unobscured parts of browser, i.e.
219 // if NonClientHitTest returns : 235 // if NonClientHitTest returns :
220 // - HTCAPTION: in title bar or unobscured part of tabstrip 236 // - HTCAPTION: in title bar or unobscured part of tabstrip
221 // - HTNOWHERE: as the name implies. 237 // - HTNOWHERE: as the name implies.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 return menu_model_builder_->menu_model(); 273 return menu_model_builder_->menu_model();
258 } 274 }
259 275
260 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() { 276 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() {
261 return browser_frame_view_->avatar_button(); 277 return browser_frame_view_->avatar_button();
262 } 278 }
263 279
264 views::View* BrowserFrame::GetNewAvatarMenuButton() { 280 views::View* BrowserFrame::GetNewAvatarMenuButton() {
265 return browser_frame_view_->GetProfileSwitcherView(); 281 return browser_frame_view_->GetProfileSwitcherView();
266 } 282 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698