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 manageable. |
| 114 ash::wm::SetWindowPositionManageable(GetNativeWindow(), true); |
112 } | 115 } |
113 #endif | 116 #endif |
114 } | 117 } |
115 | 118 |
116 /////////////////////////////////////////////////////////////////////////////// | 119 /////////////////////////////////////////////////////////////////////////////// |
117 // BrowserFrameAura, views::ContextMenuController overrides: | 120 // BrowserFrameAura, views::ContextMenuController overrides: |
118 void BrowserFrameAura::ShowContextMenuForView(views::View* source, | 121 void BrowserFrameAura::ShowContextMenuForView(views::View* source, |
119 const gfx::Point& p) { | 122 const gfx::Point& p) { |
120 // Only show context menu if point is in unobscured parts of browser, i.e. | 123 // Only show context menu if point is in unobscured parts of browser, i.e. |
121 // if NonClientHitTest returns : | 124 // if NonClientHitTest returns : |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 return new DesktopBrowserFrameAura(browser_frame, browser_view); | 216 return new DesktopBrowserFrameAura(browser_frame, browser_view); |
214 #endif | 217 #endif |
215 return new BrowserFrameAura(browser_frame, browser_view); | 218 return new BrowserFrameAura(browser_frame, browser_view); |
216 } | 219 } |
217 | 220 |
218 /////////////////////////////////////////////////////////////////////////////// | 221 /////////////////////////////////////////////////////////////////////////////// |
219 // BrowserFrameAura, private: | 222 // BrowserFrameAura, private: |
220 | 223 |
221 BrowserFrameAura::~BrowserFrameAura() { | 224 BrowserFrameAura::~BrowserFrameAura() { |
222 } | 225 } |
OLD | NEW |