| 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/chrome_views_delegate.h" | 5 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "ui/views/widget/native_widget_aura.h" | 56 #include "ui/views/widget/native_widget_aura.h" |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 59 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 60 #include "ui/views/linux_ui/linux_ui.h" | 60 #include "ui/views/linux_ui/linux_ui.h" |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 #if defined(USE_ASH) | 63 #if defined(USE_ASH) |
| 64 #include "ash/common/accelerators/accelerator_controller.h" | 64 #include "ash/common/accelerators/accelerator_controller.h" |
| 65 #include "ash/common/wm/window_state.h" | 65 #include "ash/common/wm/window_state.h" |
| 66 #include "ash/common/wm_shell.h" |
| 66 #include "ash/shell.h" | 67 #include "ash/shell.h" |
| 67 #include "ash/wm/window_state_aura.h" | 68 #include "ash/wm/window_state_aura.h" |
| 68 #include "chrome/browser/ui/ash/ash_init.h" | 69 #include "chrome/browser/ui/ash/ash_init.h" |
| 69 #endif | 70 #endif |
| 70 | 71 |
| 71 // Helpers -------------------------------------------------------------------- | 72 // Helpers -------------------------------------------------------------------- |
| 72 | 73 |
| 73 namespace { | 74 namespace { |
| 74 | 75 |
| 75 Profile* GetProfileForWindow(const views::Widget* window) { | 76 Profile* GetProfileForWindow(const views::Widget* window) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_BOTTOM, monitor)) | 165 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_BOTTOM, monitor)) |
| 165 edges |= views::ViewsDelegate::EDGE_BOTTOM; | 166 edges |= views::ViewsDelegate::EDGE_BOTTOM; |
| 166 return edges; | 167 return edges; |
| 167 } | 168 } |
| 168 #endif | 169 #endif |
| 169 | 170 |
| 170 #if defined(USE_ASH) | 171 #if defined(USE_ASH) |
| 171 void ProcessAcceleratorNow(const ui::Accelerator& accelerator) { | 172 void ProcessAcceleratorNow(const ui::Accelerator& accelerator) { |
| 172 // TODO(afakhry): See if we need here to send the accelerator to the | 173 // TODO(afakhry): See if we need here to send the accelerator to the |
| 173 // FocusManager of the active window in a follow-up CL. | 174 // FocusManager of the active window in a follow-up CL. |
| 174 ash::Shell::GetInstance()->accelerator_controller()->Process(accelerator); | 175 ash::WmShell::Get()->accelerator_controller()->Process(accelerator); |
| 175 } | 176 } |
| 176 #endif // defined(USE_ASH) | 177 #endif // defined(USE_ASH) |
| 177 | 178 |
| 178 } // namespace | 179 } // namespace |
| 179 | 180 |
| 180 | 181 |
| 181 // ChromeViewsDelegate -------------------------------------------------------- | 182 // ChromeViewsDelegate -------------------------------------------------------- |
| 182 | 183 |
| 183 #if defined(OS_WIN) | 184 #if defined(OS_WIN) |
| 184 ChromeViewsDelegate::ChromeViewsDelegate() | 185 ChromeViewsDelegate::ChromeViewsDelegate() |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 271 |
| 271 views::ViewsDelegate::ProcessMenuAcceleratorResult | 272 views::ViewsDelegate::ProcessMenuAcceleratorResult |
| 272 ChromeViewsDelegate::ProcessAcceleratorWhileMenuShowing( | 273 ChromeViewsDelegate::ProcessAcceleratorWhileMenuShowing( |
| 273 const ui::Accelerator& accelerator) { | 274 const ui::Accelerator& accelerator) { |
| 274 #if defined(USE_ASH) | 275 #if defined(USE_ASH) |
| 275 // Early return because mash chrome does not have access to ash::Shell | 276 // Early return because mash chrome does not have access to ash::Shell |
| 276 if (chrome::IsRunningInMash()) | 277 if (chrome::IsRunningInMash()) |
| 277 return views::ViewsDelegate::ProcessMenuAcceleratorResult::LEAVE_MENU_OPEN; | 278 return views::ViewsDelegate::ProcessMenuAcceleratorResult::LEAVE_MENU_OPEN; |
| 278 | 279 |
| 279 ash::AcceleratorController* accelerator_controller = | 280 ash::AcceleratorController* accelerator_controller = |
| 280 ash::Shell::GetInstance()->accelerator_controller(); | 281 ash::WmShell::Get()->accelerator_controller(); |
| 281 | 282 |
| 282 accelerator_controller->accelerator_history()->StoreCurrentAccelerator( | 283 accelerator_controller->accelerator_history()->StoreCurrentAccelerator( |
| 283 accelerator); | 284 accelerator); |
| 284 if (accelerator_controller->ShouldCloseMenuAndRepostAccelerator( | 285 if (accelerator_controller->ShouldCloseMenuAndRepostAccelerator( |
| 285 accelerator)) { | 286 accelerator)) { |
| 286 base::MessageLoopForUI::current()->task_runner()->PostTask( | 287 base::MessageLoopForUI::current()->task_runner()->PostTask( |
| 287 FROM_HERE, base::Bind(ProcessAcceleratorNow, accelerator)); | 288 FROM_HERE, base::Bind(ProcessAcceleratorNow, accelerator)); |
| 288 return views::ViewsDelegate::ProcessMenuAcceleratorResult::CLOSE_MENU; | 289 return views::ViewsDelegate::ProcessMenuAcceleratorResult::CLOSE_MENU; |
| 289 } | 290 } |
| 290 | 291 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 return content::BrowserThread::GetBlockingPool(); | 506 return content::BrowserThread::GetBlockingPool(); |
| 506 } | 507 } |
| 507 | 508 |
| 508 #if !defined(USE_ASH) | 509 #if !defined(USE_ASH) |
| 509 views::Widget::InitParams::WindowOpacity | 510 views::Widget::InitParams::WindowOpacity |
| 510 ChromeViewsDelegate::GetOpacityForInitParams( | 511 ChromeViewsDelegate::GetOpacityForInitParams( |
| 511 const views::Widget::InitParams& params) { | 512 const views::Widget::InitParams& params) { |
| 512 return views::Widget::InitParams::OPAQUE_WINDOW; | 513 return views::Widget::InitParams::OPAQUE_WINDOW; |
| 513 } | 514 } |
| 514 #endif | 515 #endif |
| OLD | NEW |