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" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 resizable_ = create_params.resizable; | 259 resizable_ = create_params.resizable; |
260 Observe(web_contents()); | 260 Observe(web_contents()); |
261 | 261 |
262 window_ = new views::Widget; | 262 window_ = new views::Widget; |
263 if (create_params.window_type == ShellWindow::WINDOW_TYPE_PANEL || | 263 if (create_params.window_type == ShellWindow::WINDOW_TYPE_PANEL || |
264 create_params.window_type == ShellWindow::WINDOW_TYPE_V1_PANEL) { | 264 create_params.window_type == ShellWindow::WINDOW_TYPE_V1_PANEL) { |
265 InitializePanelWindow(create_params); | 265 InitializePanelWindow(create_params); |
266 } else { | 266 } else { |
267 InitializeDefaultWindow(create_params); | 267 InitializeDefaultWindow(create_params); |
268 } | 268 } |
269 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 269 extension_keybinding_registry_.reset( |
270 Profile::FromBrowserContext(browser_context()), | 270 new ExtensionKeybindingRegistryViews( |
271 window_->GetFocusManager(), | 271 profile(), |
272 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 272 window_->GetFocusManager(), |
273 shell_window_)); | 273 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
| 274 shell_window_)); |
274 | 275 |
275 OnViewWasResized(); | 276 OnViewWasResized(); |
276 window_->AddObserver(this); | 277 window_->AddObserver(this); |
277 } | 278 } |
278 | 279 |
279 NativeAppWindowViews::~NativeAppWindowViews() { | 280 NativeAppWindowViews::~NativeAppWindowViews() { |
280 web_view_->SetWebContents(NULL); | 281 web_view_->SetWebContents(NULL); |
281 } | 282 } |
282 | 283 |
283 void NativeAppWindowViews::OnBeforeWidgetInit( | 284 void NativeAppWindowViews::OnBeforeWidgetInit( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 if (is_kiosk_app_mode && !chrome::IsCommandAllowedInAppMode(iter->second)) | 355 if (is_kiosk_app_mode && !chrome::IsCommandAllowedInAppMode(iter->second)) |
355 continue; | 356 continue; |
356 | 357 |
357 focus_manager->RegisterAccelerator( | 358 focus_manager->RegisterAccelerator( |
358 iter->first, ui::AcceleratorManager::kNormalPriority, this); | 359 iter->first, ui::AcceleratorManager::kNormalPriority, this); |
359 } | 360 } |
360 | 361 |
361 #if defined(OS_WIN) | 362 #if defined(OS_WIN) |
362 base::string16 app_name_wide = base::UTF8ToWide(app_name); | 363 base::string16 app_name_wide = base::UTF8ToWide(app_name); |
363 HWND hwnd = GetNativeAppWindowHWND(); | 364 HWND hwnd = GetNativeAppWindowHWND(); |
364 ui::win::SetAppIdForWindow( | 365 ui::win::SetAppIdForWindow(ShellIntegration::GetAppModelIdForProfile( |
365 ShellIntegration::GetAppModelIdForProfile( | 366 app_name_wide, profile()->GetPath()), hwnd); |
366 app_name_wide, | |
367 Profile::FromBrowserContext(browser_context())->GetPath()), | |
368 hwnd); | |
369 | 367 |
370 web_app::UpdateShortcutInfoAndIconForApp( | 368 web_app::UpdateShortcutInfoAndIconForApp( |
371 *extension(), | 369 *extension(), profile(), |
372 Profile::FromBrowserContext(browser_context()), | |
373 base::Bind(&NativeAppWindowViews::OnShortcutInfoLoaded, | 370 base::Bind(&NativeAppWindowViews::OnShortcutInfoLoaded, |
374 weak_ptr_factory_.GetWeakPtr())); | 371 weak_ptr_factory_.GetWeakPtr())); |
375 #endif | 372 #endif |
376 } | 373 } |
377 | 374 |
378 #if defined(OS_WIN) | 375 #if defined(OS_WIN) |
379 void NativeAppWindowViews::OnShortcutInfoLoaded( | 376 void NativeAppWindowViews::OnShortcutInfoLoaded( |
380 const ShellIntegration::ShortcutInfo& shortcut_info) { | 377 const ShellIntegration::ShortcutInfo& shortcut_info) { |
381 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 378 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
382 | 379 |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 gfx::Rect client_bounds = gfx::Rect(1000, 1000); | 1052 gfx::Rect client_bounds = gfx::Rect(1000, 1000); |
1056 gfx::Rect window_bounds = | 1053 gfx::Rect window_bounds = |
1057 window_->non_client_view()->GetWindowBoundsForClientBounds( | 1054 window_->non_client_view()->GetWindowBoundsForClientBounds( |
1058 client_bounds); | 1055 client_bounds); |
1059 return window_bounds.InsetsFrom(client_bounds); | 1056 return window_bounds.InsetsFrom(client_bounds); |
1060 } | 1057 } |
1061 | 1058 |
1062 void NativeAppWindowViews::HideWithApp() {} | 1059 void NativeAppWindowViews::HideWithApp() {} |
1063 void NativeAppWindowViews::ShowWithApp() {} | 1060 void NativeAppWindowViews::ShowWithApp() {} |
1064 void NativeAppWindowViews::UpdateWindowMinMaxSize() {} | 1061 void NativeAppWindowViews::UpdateWindowMinMaxSize() {} |
OLD | NEW |