Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1023)

Side by Side Diff: trunk/src/chrome/browser/ui/views/apps/native_app_window_views.cc

Issue 164613002: Revert 251094 "Revert 250826 "Remove Profile dependency from app..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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( 269 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews(
270 new ExtensionKeybindingRegistryViews( 270 Profile::FromBrowserContext(browser_context()),
271 profile(), 271 window_->GetFocusManager(),
272 window_->GetFocusManager(), 272 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
273 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, 273 shell_window_));
274 shell_window_));
275 274
276 OnViewWasResized(); 275 OnViewWasResized();
277 window_->AddObserver(this); 276 window_->AddObserver(this);
278 } 277 }
279 278
280 NativeAppWindowViews::~NativeAppWindowViews() { 279 NativeAppWindowViews::~NativeAppWindowViews() {
281 web_view_->SetWebContents(NULL); 280 web_view_->SetWebContents(NULL);
282 } 281 }
283 282
284 void NativeAppWindowViews::OnBeforeWidgetInit( 283 void NativeAppWindowViews::OnBeforeWidgetInit(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (is_kiosk_app_mode && !chrome::IsCommandAllowedInAppMode(iter->second)) 354 if (is_kiosk_app_mode && !chrome::IsCommandAllowedInAppMode(iter->second))
356 continue; 355 continue;
357 356
358 focus_manager->RegisterAccelerator( 357 focus_manager->RegisterAccelerator(
359 iter->first, ui::AcceleratorManager::kNormalPriority, this); 358 iter->first, ui::AcceleratorManager::kNormalPriority, this);
360 } 359 }
361 360
362 #if defined(OS_WIN) 361 #if defined(OS_WIN)
363 base::string16 app_name_wide = base::UTF8ToWide(app_name); 362 base::string16 app_name_wide = base::UTF8ToWide(app_name);
364 HWND hwnd = GetNativeAppWindowHWND(); 363 HWND hwnd = GetNativeAppWindowHWND();
365 ui::win::SetAppIdForWindow(ShellIntegration::GetAppModelIdForProfile( 364 ui::win::SetAppIdForWindow(
366 app_name_wide, profile()->GetPath()), hwnd); 365 ShellIntegration::GetAppModelIdForProfile(
366 app_name_wide,
367 Profile::FromBrowserContext(browser_context())->GetPath()),
368 hwnd);
367 369
368 web_app::UpdateShortcutInfoAndIconForApp( 370 web_app::UpdateShortcutInfoAndIconForApp(
369 *extension(), profile(), 371 *extension(),
372 Profile::FromBrowserContext(browser_context()),
370 base::Bind(&NativeAppWindowViews::OnShortcutInfoLoaded, 373 base::Bind(&NativeAppWindowViews::OnShortcutInfoLoaded,
371 weak_ptr_factory_.GetWeakPtr())); 374 weak_ptr_factory_.GetWeakPtr()));
372 #endif 375 #endif
373 } 376 }
374 377
375 #if defined(OS_WIN) 378 #if defined(OS_WIN)
376 void NativeAppWindowViews::OnShortcutInfoLoaded( 379 void NativeAppWindowViews::OnShortcutInfoLoaded(
377 const ShellIntegration::ShortcutInfo& shortcut_info) { 380 const ShellIntegration::ShortcutInfo& shortcut_info) {
378 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 381 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
379 382
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 gfx::Rect client_bounds = gfx::Rect(1000, 1000); 1055 gfx::Rect client_bounds = gfx::Rect(1000, 1000);
1053 gfx::Rect window_bounds = 1056 gfx::Rect window_bounds =
1054 window_->non_client_view()->GetWindowBoundsForClientBounds( 1057 window_->non_client_view()->GetWindowBoundsForClientBounds(
1055 client_bounds); 1058 client_bounds);
1056 return window_bounds.InsetsFrom(client_bounds); 1059 return window_bounds.InsetsFrom(client_bounds);
1057 } 1060 }
1058 1061
1059 void NativeAppWindowViews::HideWithApp() {} 1062 void NativeAppWindowViews::HideWithApp() {}
1060 void NativeAppWindowViews::ShowWithApp() {} 1063 void NativeAppWindowViews::ShowWithApp() {}
1061 void NativeAppWindowViews::UpdateWindowMinMaxSize() {} 1064 void NativeAppWindowViews::UpdateWindowMinMaxSize() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698