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/chromeos/extensions/file_manager/private_api_misc.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_misc.h" |
6 | 6 |
7 #include "apps/app_window.h" | 7 #include "apps/app_window.h" |
8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
9 #include "ash/frame/frame_util.h" | 9 #include "ash/frame/frame_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chromeos/drive/file_system_util.h" | 15 #include "chrome/browser/chromeos/drive/file_system_util.h" |
16 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" | 16 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" |
17 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_a
pi.h" | 17 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_a
pi.h" |
18 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 18 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
19 #include "chrome/browser/chromeos/file_manager/app_installer.h" | 19 #include "chrome/browser/chromeos/file_manager/app_installer.h" |
20 #include "chrome/browser/chromeos/file_manager/zip_file_creator.h" | 20 #include "chrome/browser/chromeos/file_manager/zip_file_creator.h" |
21 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
22 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 21 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
23 #include "chrome/browser/chromeos/settings/cros_settings.h" | 22 #include "chrome/browser/chromeos/settings/cros_settings.h" |
24 #include "chrome/browser/devtools/devtools_window.h" | 23 #include "chrome/browser/devtools/devtools_window.h" |
25 #include "chrome/browser/drive/event_logger.h" | 24 #include "chrome/browser/drive/event_logger.h" |
26 #include "chrome/browser/extensions/devtools_util.h" | 25 #include "chrome/browser/extensions/devtools_util.h" |
27 #include "chrome/browser/lifetime/application_lifetime.h" | 26 #include "chrome/browser/lifetime/application_lifetime.h" |
28 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
30 #include "chrome/browser/profiles/profiles_state.h" | 29 #include "chrome/browser/profiles/profiles_state.h" |
31 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 30 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
32 #include "chrome/browser/signin/signin_manager_factory.h" | 31 #include "chrome/browser/signin/signin_manager_factory.h" |
33 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 32 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
34 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 33 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
35 #include "chrome/common/extensions/api/file_browser_private.h" | 34 #include "chrome/common/extensions/api/file_browser_private.h" |
36 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
37 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 36 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
38 #include "components/signin/core/browser/signin_manager.h" | 37 #include "components/signin/core/browser/signin_manager.h" |
| 38 #include "components/user_manager/user_manager.h" |
39 #include "content/public/browser/render_view_host.h" | 39 #include "content/public/browser/render_view_host.h" |
40 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" |
41 #include "content/public/common/page_zoom.h" | 41 #include "content/public/common/page_zoom.h" |
42 #include "google_apis/drive/auth_service.h" | 42 #include "google_apis/drive/auth_service.h" |
43 #include "ui/base/webui/web_ui_util.h" | 43 #include "ui/base/webui/web_ui_util.h" |
44 #include "url/gurl.h" | 44 #include "url/gurl.h" |
45 | 45 |
46 namespace extensions { | 46 namespace extensions { |
47 | 47 |
48 namespace { | 48 namespace { |
49 const char kCWSScope[] = "https://www.googleapis.com/auth/chromewebstore"; | 49 const char kCWSScope[] = "https://www.googleapis.com/auth/chromewebstore"; |
50 const char kGoogleCastApiExtensionId[] = "mafeflapfdfljijmlienjedomfjfmhpd"; | 50 const char kGoogleCastApiExtensionId[] = "mafeflapfdfljijmlienjedomfjfmhpd"; |
51 | 51 |
52 // Obtains the current app window. | 52 // Obtains the current app window. |
53 apps::AppWindow* GetCurrentAppWindow(ChromeSyncExtensionFunction* function) { | 53 apps::AppWindow* GetCurrentAppWindow(ChromeSyncExtensionFunction* function) { |
54 apps::AppWindowRegistry* const app_window_registry = | 54 apps::AppWindowRegistry* const app_window_registry = |
55 apps::AppWindowRegistry::Get(function->GetProfile()); | 55 apps::AppWindowRegistry::Get(function->GetProfile()); |
56 content::WebContents* const contents = function->GetAssociatedWebContents(); | 56 content::WebContents* const contents = function->GetAssociatedWebContents(); |
57 content::RenderViewHost* const render_view_host = | 57 content::RenderViewHost* const render_view_host = |
58 contents ? contents->GetRenderViewHost() : NULL; | 58 contents ? contents->GetRenderViewHost() : NULL; |
59 return render_view_host ? app_window_registry->GetAppWindowForRenderViewHost( | 59 return render_view_host ? app_window_registry->GetAppWindowForRenderViewHost( |
60 render_view_host) | 60 render_view_host) |
61 : NULL; | 61 : NULL; |
62 } | 62 } |
63 | 63 |
64 std::vector<linked_ptr<api::file_browser_private::ProfileInfo> > | 64 std::vector<linked_ptr<api::file_browser_private::ProfileInfo> > |
65 GetLoggedInProfileInfoList(content::WebContents* contents) { | 65 GetLoggedInProfileInfoList(content::WebContents* contents) { |
66 DCHECK(chromeos::UserManager::IsInitialized()); | 66 DCHECK(user_manager::UserManager::IsInitialized()); |
67 const std::vector<Profile*>& profiles = | 67 const std::vector<Profile*>& profiles = |
68 g_browser_process->profile_manager()->GetLoadedProfiles(); | 68 g_browser_process->profile_manager()->GetLoadedProfiles(); |
69 std::set<Profile*> original_profiles; | 69 std::set<Profile*> original_profiles; |
70 std::vector<linked_ptr<api::file_browser_private::ProfileInfo> > | 70 std::vector<linked_ptr<api::file_browser_private::ProfileInfo> > |
71 result_profiles; | 71 result_profiles; |
72 | 72 |
73 for (size_t i = 0; i < profiles.size(); ++i) { | 73 for (size_t i = 0; i < profiles.size(); ++i) { |
74 // Filter the profile. | 74 // Filter the profile. |
75 Profile* const profile = profiles[i]->GetOriginalProfile(); | 75 Profile* const profile = profiles[i]->GetOriginalProfile(); |
76 if (original_profiles.count(profile)) | 76 if (original_profiles.count(profile)) |
(...skipping 28 matching lines...) Expand all Loading... |
105 } | 105 } |
106 | 106 |
107 return result_profiles; | 107 return result_profiles; |
108 } | 108 } |
109 } // namespace | 109 } // namespace |
110 | 110 |
111 bool FileBrowserPrivateLogoutUserForReauthenticationFunction::RunSync() { | 111 bool FileBrowserPrivateLogoutUserForReauthenticationFunction::RunSync() { |
112 user_manager::User* user = | 112 user_manager::User* user = |
113 chromeos::ProfileHelper::Get()->GetUserByProfile(GetProfile()); | 113 chromeos::ProfileHelper::Get()->GetUserByProfile(GetProfile()); |
114 if (user) { | 114 if (user) { |
115 chromeos::UserManager::Get()->SaveUserOAuthStatus( | 115 user_manager::UserManager::Get()->SaveUserOAuthStatus( |
116 user->email(), user_manager::User::OAUTH2_TOKEN_STATUS_INVALID); | 116 user->email(), user_manager::User::OAUTH2_TOKEN_STATUS_INVALID); |
117 } | 117 } |
118 | 118 |
119 chrome::AttemptUserExit(); | 119 chrome::AttemptUserExit(); |
120 return true; | 120 return true; |
121 } | 121 } |
122 | 122 |
123 bool FileBrowserPrivateGetPreferencesFunction::RunSync() { | 123 bool FileBrowserPrivateGetPreferencesFunction::RunSync() { |
124 api::file_browser_private::Preferences result; | 124 api::file_browser_private::Preferences result; |
125 const PrefService* const service = GetProfile()->GetPrefs(); | 125 const PrefService* const service = GetProfile()->GetPrefs(); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 NOTREACHED(); | 481 NOTREACHED(); |
482 SetError( | 482 SetError( |
483 base::StringPrintf("Unexpected inspection type(%d) is specified.", | 483 base::StringPrintf("Unexpected inspection type(%d) is specified.", |
484 static_cast<int>(params->type))); | 484 static_cast<int>(params->type))); |
485 return false; | 485 return false; |
486 } | 486 } |
487 return true; | 487 return true; |
488 } | 488 } |
489 | 489 |
490 } // namespace extensions | 490 } // namespace extensions |
OLD | NEW |