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_aura.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame_aura.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
10 #include "chrome/browser/ui/views/frame/system_menu_model_delegate.h" | 10 #include "chrome/browser/ui/views/frame/system_menu_model_delegate.h" |
11 #include "grit/chromium_strings.h" | 11 #include "grit/chromium_strings.h" |
12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
13 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
15 #include "ui/aura/window_observer.h" | 15 #include "ui/aura/window_observer.h" |
16 #include "ui/base/hit_test.h" | 16 #include "ui/base/hit_test.h" |
17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/base/models/simple_menu_model.h" | 18 #include "ui/base/models/simple_menu_model.h" |
19 #include "ui/gfx/font.h" | 19 #include "ui/gfx/font.h" |
20 #include "ui/views/controls/menu/menu_model_adapter.h" | 20 #include "ui/views/controls/menu/menu_model_adapter.h" |
21 #include "ui/views/controls/menu/menu_runner.h" | 21 #include "ui/views/controls/menu/menu_runner.h" |
22 #include "ui/views/view.h" | 22 #include "ui/views/view.h" |
23 #include "ui/views/views_switches.h" | 23 #include "ui/views/views_switches.h" |
24 | 24 |
25 #if defined(USE_ASH) | 25 #if defined(USE_ASH) |
26 #include "ash/wm/property_util.h" | 26 #include "ash/wm/property_util.h" |
27 #include "ash/wm/window_util.h" | |
27 #endif | 28 #endif |
28 | 29 |
29 #if !defined(OS_CHROMEOS) | 30 #if !defined(OS_CHROMEOS) |
30 #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h" | 31 #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h" |
31 #endif | 32 #endif |
32 | 33 |
33 using aura::Window; | 34 using aura::Window; |
34 | 35 |
35 //////////////////////////////////////////////////////////////////////////////// | 36 //////////////////////////////////////////////////////////////////////////////// |
36 // BrowserFrameAura::WindowPropertyWatcher | 37 // BrowserFrameAura::WindowPropertyWatcher |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 GetNativeWindow()->SetName("BrowserFrameAura"); | 103 GetNativeWindow()->SetName("BrowserFrameAura"); |
103 GetNativeWindow()->AddObserver(window_property_watcher_.get()); | 104 GetNativeWindow()->AddObserver(window_property_watcher_.get()); |
104 #if defined(USE_ASH) | 105 #if defined(USE_ASH) |
105 // Tabbed browsers and apps (some apps are TYPE_POPUP) get their own | 106 // Tabbed browsers and apps (some apps are TYPE_POPUP) get their own |
106 // workspace. | 107 // workspace. |
107 if (browser_view->browser()->type() != Browser::TYPE_POPUP || | 108 if (browser_view->browser()->type() != Browser::TYPE_POPUP || |
108 browser_view->browser()->is_app()) { | 109 browser_view->browser()->is_app()) { |
109 ash::SetPersistsAcrossAllWorkspaces( | 110 ash::SetPersistsAcrossAllWorkspaces( |
110 GetNativeWindow(), | 111 GetNativeWindow(), |
111 ash::WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_NO); | 112 ash::WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_NO); |
113 // Also mark this window as automatically position managed. | |
114 ash::wm::SetWindowPositionManaged(GetNativeWindow(), true); | |
115 // If the browser got restored and was previously positioned by the user, | |
116 // the flag gets restored. | |
117 if (browser_view->browser()->initial_user_has_changed_window_or_position()) | |
sky
2012/10/17 15:59:38
I don't think we should persist this. That's too m
Mr4D (OOO till 08-26)
2012/10/17 18:43:56
If we don't, the desktop will not be restored to t
sky
2012/10/18 16:11:19
smaller patches=easier to review and land .
Can y
Mr4D (OOO till 08-26)
2012/10/19 20:46:04
Since the requirement has changed this was removed
| |
118 ash::wm::SetUserHasChangedWindowPositionOrSize(GetNativeWindow(), true); | |
112 } | 119 } |
113 #endif | 120 #endif |
114 } | 121 } |
115 | 122 |
116 /////////////////////////////////////////////////////////////////////////////// | 123 /////////////////////////////////////////////////////////////////////////////// |
117 // BrowserFrameAura, views::ContextMenuController overrides: | 124 // BrowserFrameAura, views::ContextMenuController overrides: |
118 void BrowserFrameAura::ShowContextMenuForView(views::View* source, | 125 void BrowserFrameAura::ShowContextMenuForView(views::View* source, |
119 const gfx::Point& p) { | 126 const gfx::Point& p) { |
120 // Only show context menu if point is in unobscured parts of browser, i.e. | 127 // Only show context menu if point is in unobscured parts of browser, i.e. |
121 // if NonClientHitTest returns : | 128 // if NonClientHitTest returns : |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 return new DesktopBrowserFrameAura(browser_frame, browser_view); | 220 return new DesktopBrowserFrameAura(browser_frame, browser_view); |
214 #endif | 221 #endif |
215 return new BrowserFrameAura(browser_frame, browser_view); | 222 return new BrowserFrameAura(browser_frame, browser_view); |
216 } | 223 } |
217 | 224 |
218 /////////////////////////////////////////////////////////////////////////////// | 225 /////////////////////////////////////////////////////////////////////////////// |
219 // BrowserFrameAura, private: | 226 // BrowserFrameAura, private: |
220 | 227 |
221 BrowserFrameAura::~BrowserFrameAura() { | 228 BrowserFrameAura::~BrowserFrameAura() { |
222 } | 229 } |
OLD | NEW |