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

Side by Side Diff: chrome/browser/ui/webui/options/options_handlers_helper.cc

Issue 494033002: Move AppWindow to extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unneeded include in chrome_shell_delegate.cc Created 6 years, 3 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 "apps/app_window.h"
6 #include "apps/app_window_registry.h"
7 #include "base/bind.h" 5 #include "base/bind.h"
8 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile_manager.h" 7 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/profiles/profile_metrics.h" 8 #include "chrome/browser/profiles/profile_metrics.h"
11 #include "chrome/browser/profiles/profile_window.h" 9 #include "chrome/browser/profiles/profile_window.h"
12 #include "chrome/browser/profiles/profiles_state.h" 10 #include "chrome/browser/profiles/profiles_state.h"
13 #include "chrome/browser/ui/browser_finder.h" 11 #include "chrome/browser/ui/browser_finder.h"
14 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
15 #include "content/public/browser/web_ui.h" 13 #include "content/public/browser/web_ui.h"
14 #include "extensions/browser/app_window/app_window.h"
15 #include "extensions/browser/app_window/app_window_registry.h"
16 16
17 namespace options { 17 namespace options {
18 namespace helper { 18 namespace helper {
19 19
20 chrome::HostDesktopType GetDesktopType(content::WebUI* web_ui) { 20 chrome::HostDesktopType GetDesktopType(content::WebUI* web_ui) {
21 DCHECK(web_ui); 21 DCHECK(web_ui);
22 content::WebContents* web_contents = web_ui->GetWebContents(); 22 content::WebContents* web_contents = web_ui->GetWebContents();
23 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 23 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
24 if (browser) 24 if (browser)
25 return browser->host_desktop_type(); 25 return browser->host_desktop_type();
26 26
27 apps::AppWindow* app_window = 27 extensions::AppWindow* app_window =
28 apps::AppWindowRegistry::Get(Profile::FromWebUI(web_ui)) 28 extensions::AppWindowRegistry::Get(Profile::FromWebUI(web_ui))
29 ->GetAppWindowForRenderViewHost(web_contents->GetRenderViewHost()); 29 ->GetAppWindowForRenderViewHost(web_contents->GetRenderViewHost());
30 if (app_window) { 30 if (app_window) {
31 return chrome::GetHostDesktopTypeForNativeWindow( 31 return chrome::GetHostDesktopTypeForNativeWindow(
32 app_window->GetNativeWindow()); 32 app_window->GetNativeWindow());
33 } 33 }
34 34
35 return chrome::GetActiveDesktop(); 35 return chrome::GetActiveDesktop();
36 } 36 }
37 37
38 void OpenNewWindowForProfile(chrome::HostDesktopType desktop_type, 38 void OpenNewWindowForProfile(chrome::HostDesktopType desktop_type,
(...skipping 23 matching lines...) Expand all
62 62
63 ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::DELETE_PROFILE_SETTINGS); 63 ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::DELETE_PROFILE_SETTINGS);
64 64
65 g_browser_process->profile_manager()->ScheduleProfileForDeletion( 65 g_browser_process->profile_manager()->ScheduleProfileForDeletion(
66 file_path, 66 file_path,
67 base::Bind(&OpenNewWindowForProfile, GetDesktopType(web_ui))); 67 base::Bind(&OpenNewWindowForProfile, GetDesktopType(web_ui)));
68 } 68 }
69 69
70 } // namespace helper 70 } // namespace helper
71 } // namespace options 71 } // namespace options
72
73
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698