| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/native_app_window_views.h" | 5 #include "chrome/browser/ui/views/apps/native_app_window_views.h" |
| 6 | 6 |
| 7 #include "apps/shell_window.h" | 7 #include "apps/shell_window.h" |
| 8 #include "apps/ui/views/shell_window_frame_view.h" | 8 #include "apps/ui/views/shell_window_frame_view.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/threading/sequenced_worker_pool.h" | 12 #include "base/threading/sequenced_worker_pool.h" |
| 13 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
| 14 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 14 #include "chrome/browser/extensions/extension_host.h" | 15 #include "chrome/browser/extensions/extension_host.h" |
| 15 #include "chrome/browser/favicon/favicon_tab_helper.h" | 16 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" | 18 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" |
| 18 #include "chrome/browser/ui/host_desktop.h" | 19 #include "chrome/browser/ui/host_desktop.h" |
| 19 #include "chrome/browser/ui/views/apps/shaped_app_window_targeter.h" | 20 #include "chrome/browser/ui/views/apps/shaped_app_window_targeter.h" |
| 20 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" | 21 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" |
| 21 #include "chrome/browser/web_applications/web_app.h" | 22 #include "chrome/browser/web_applications/web_app.h" |
| 22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 if (!position_specified) | 295 if (!position_specified) |
| 295 window_->CenterWindow(adjusted_bounds.size()); | 296 window_->CenterWindow(adjusted_bounds.size()); |
| 296 else if (!adjusted_bounds.IsEmpty() && adjusted_bounds != window_bounds) | 297 else if (!adjusted_bounds.IsEmpty() && adjusted_bounds != window_bounds) |
| 297 window_->SetBounds(adjusted_bounds); | 298 window_->SetBounds(adjusted_bounds); |
| 298 | 299 |
| 299 // Register accelarators supported by app windows. | 300 // Register accelarators supported by app windows. |
| 300 // TODO(jeremya/stevenjb): should these be registered for panels too? | 301 // TODO(jeremya/stevenjb): should these be registered for panels too? |
| 301 views::FocusManager* focus_manager = GetFocusManager(); | 302 views::FocusManager* focus_manager = GetFocusManager(); |
| 302 const std::map<ui::Accelerator, int>& accelerator_table = | 303 const std::map<ui::Accelerator, int>& accelerator_table = |
| 303 GetAcceleratorTable(); | 304 GetAcceleratorTable(); |
| 305 const bool is_kiosk_app_mode = chrome::IsRunningInForcedAppMode(); |
| 304 for (std::map<ui::Accelerator, int>::const_iterator iter = | 306 for (std::map<ui::Accelerator, int>::const_iterator iter = |
| 305 accelerator_table.begin(); | 307 accelerator_table.begin(); |
| 306 iter != accelerator_table.end(); ++iter) { | 308 iter != accelerator_table.end(); ++iter) { |
| 309 if (is_kiosk_app_mode && !chrome::IsCommandAllowedInAppMode(iter->second)) |
| 310 continue; |
| 311 |
| 307 focus_manager->RegisterAccelerator( | 312 focus_manager->RegisterAccelerator( |
| 308 iter->first, ui::AcceleratorManager::kNormalPriority, this); | 313 iter->first, ui::AcceleratorManager::kNormalPriority, this); |
| 309 } | 314 } |
| 310 | 315 |
| 311 #if defined(OS_WIN) | 316 #if defined(OS_WIN) |
| 312 base::string16 app_name_wide = base::UTF8ToWide(app_name); | 317 base::string16 app_name_wide = base::UTF8ToWide(app_name); |
| 313 HWND hwnd = GetNativeAppWindowHWND(); | 318 HWND hwnd = GetNativeAppWindowHWND(); |
| 314 ui::win::SetAppIdForWindow(ShellIntegration::GetAppModelIdForProfile( | 319 ui::win::SetAppIdForWindow(ShellIntegration::GetAppModelIdForProfile( |
| 315 app_name_wide, profile()->GetPath()), hwnd); | 320 app_name_wide, profile()->GetPath()), hwnd); |
| 316 | 321 |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 gfx::Rect client_bounds = gfx::Rect(1000, 1000); | 978 gfx::Rect client_bounds = gfx::Rect(1000, 1000); |
| 974 gfx::Rect window_bounds = | 979 gfx::Rect window_bounds = |
| 975 window_->non_client_view()->GetWindowBoundsForClientBounds( | 980 window_->non_client_view()->GetWindowBoundsForClientBounds( |
| 976 client_bounds); | 981 client_bounds); |
| 977 return window_bounds.InsetsFrom(client_bounds); | 982 return window_bounds.InsetsFrom(client_bounds); |
| 978 } | 983 } |
| 979 | 984 |
| 980 void NativeAppWindowViews::HideWithApp() {} | 985 void NativeAppWindowViews::HideWithApp() {} |
| 981 void NativeAppWindowViews::ShowWithApp() {} | 986 void NativeAppWindowViews::ShowWithApp() {} |
| 982 void NativeAppWindowViews::UpdateWindowMinMaxSize() {} | 987 void NativeAppWindowViews::UpdateWindowMinMaxSize() {} |
| OLD | NEW |