#include "chrome/browser/chromeos/extensions/file_manager/private_api_misc.h"
-#include "apps/app_window.h"
-#include "apps/app_window_registry.h"
#include "ash/frame/frame_util.h"
#include "base/files/file_path.h"
#include "base/prefs/pref_service.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
-#include "chrome/browser/chromeos/extensions/file_manager/event_router.h"
-#include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h"
#include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h"
#include "chrome/browser/chromeos/file_manager/app_installer.h"
#include "chrome/browser/chromeos/file_manager/zip_file_creator.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
-#include "chrome/common/extensions/api/file_browser_private.h"
+#include "chrome/common/extensions/api/file_manager_private.h"
#include "chrome/common/pref_names.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_zoom.h"
+#include "extensions/browser/app_window/app_window.h"
+#include "extensions/browser/app_window/app_window_registry.h"
#include "google_apis/drive/auth_service.h"
#include "ui/base/webui/web_ui_util.h"
#include "url/gurl.h"
const char kGoogleCastApiExtensionId[] = "mafeflapfdfljijmlienjedomfjfmhpd";
// Obtains the current app window.
-apps::AppWindow* GetCurrentAppWindow(ChromeSyncExtensionFunction* function) {
- apps::AppWindowRegistry* const app_window_registry =
- apps::AppWindowRegistry::Get(function->GetProfile());
+AppWindow* GetCurrentAppWindow(ChromeSyncExtensionFunction* function) {
+ AppWindowRegistry* const app_window_registry =
+ AppWindowRegistry::Get(function->GetProfile());
content::WebContents* const contents = function->GetAssociatedWebContents();
content::RenderViewHost* const render_view_host =
contents ? contents->GetRenderViewHost() : NULL;
: NULL;
}
-std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >
+std::vector<linked_ptr<api::file_manager_private::ProfileInfo> >
GetLoggedInProfileInfoList() {
DCHECK(user_manager::UserManager::IsInitialized());
const std::vector<Profile*>& profiles =
g_browser_process->profile_manager()->GetLoadedProfiles();
std::set<Profile*> original_profiles;
- std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >
+ std::vector<linked_ptr<api::file_manager_private::ProfileInfo> >
result_profiles;
for (size_t i = 0; i < profiles.size(); ++i) {
continue;
// Make a ProfileInfo.
- linked_ptr<api::file_browser_private::ProfileInfo> profile_info(
- new api::file_browser_private::ProfileInfo());
+ linked_ptr<api::file_manager_private::ProfileInfo> profile_info(
+ new api::file_manager_private::ProfileInfo());
profile_info->profile_id = multi_user_util::GetUserIDFromProfile(profile);
profile_info->display_name = UTF16ToUTF8(user->GetDisplayName());
// TODO(hirono): Remove the property from the profile_info.
}
} // namespace
-bool FileBrowserPrivateLogoutUserForReauthenticationFunction::RunSync() {
+bool FileManagerPrivateLogoutUserForReauthenticationFunction::RunSync() {
user_manager::User* user =
chromeos::ProfileHelper::Get()->GetUserByProfile(GetProfile());
if (user) {
return true;
}
-bool FileBrowserPrivateGetPreferencesFunction::RunSync() {
- api::file_browser_private::Preferences result;
+bool FileManagerPrivateGetPreferencesFunction::RunSync() {
+ api::file_manager_private::Preferences result;
const PrefService* const service = GetProfile()->GetPrefs();
result.drive_enabled = drive::util::IsDriveEnabledForProfile(GetProfile());
return true;
}
-bool FileBrowserPrivateSetPreferencesFunction::RunSync() {
- using extensions::api::file_browser_private::SetPreferences::Params;
+bool FileManagerPrivateSetPreferencesFunction::RunSync() {
+ using extensions::api::file_manager_private::SetPreferences::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
return true;
}
-FileBrowserPrivateZipSelectionFunction::
- FileBrowserPrivateZipSelectionFunction() {}
+FileManagerPrivateZipSelectionFunction::
+ FileManagerPrivateZipSelectionFunction() {}
-FileBrowserPrivateZipSelectionFunction::
- ~FileBrowserPrivateZipSelectionFunction() {}
+FileManagerPrivateZipSelectionFunction::
+ ~FileManagerPrivateZipSelectionFunction() {}
-bool FileBrowserPrivateZipSelectionFunction::RunAsync() {
- using extensions::api::file_browser_private::ZipSelection::Params;
+bool FileManagerPrivateZipSelectionFunction::RunAsync() {
+ using extensions::api::file_manager_private::ZipSelection::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
}
(new file_manager::ZipFileCreator(
- base::Bind(&FileBrowserPrivateZipSelectionFunction::OnZipDone, this),
+ base::Bind(&FileManagerPrivateZipSelectionFunction::OnZipDone, this),
src_dir,
src_relative_paths,
dest_file))->Start();
return true;
}
-void FileBrowserPrivateZipSelectionFunction::OnZipDone(bool success) {
+void FileManagerPrivateZipSelectionFunction::OnZipDone(bool success) {
SetResult(new base::FundamentalValue(success));
SendResponse(true);
}
-bool FileBrowserPrivateZoomFunction::RunSync() {
- using extensions::api::file_browser_private::Zoom::Params;
+bool FileManagerPrivateZoomFunction::RunSync() {
+ using extensions::api::file_manager_private::Zoom::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
content::PageZoom zoom_type;
switch (params->operation) {
- case api::file_browser_private::ZOOM_OPERATION_TYPE_IN:
+ case api::file_manager_private::ZOOM_OPERATION_TYPE_IN:
zoom_type = content::PAGE_ZOOM_IN;
break;
- case api::file_browser_private::ZOOM_OPERATION_TYPE_OUT:
+ case api::file_manager_private::ZOOM_OPERATION_TYPE_OUT:
zoom_type = content::PAGE_ZOOM_OUT;
break;
- case api::file_browser_private::ZOOM_OPERATION_TYPE_RESET:
+ case api::file_manager_private::ZOOM_OPERATION_TYPE_RESET:
zoom_type = content::PAGE_ZOOM_RESET;
break;
default:
return true;
}
-bool FileBrowserPrivateInstallWebstoreItemFunction::RunAsync() {
- using extensions::api::file_browser_private::InstallWebstoreItem::Params;
+bool FileManagerPrivateInstallWebstoreItemFunction::RunAsync() {
+ using extensions::api::file_manager_private::InstallWebstoreItem::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const extensions::WebstoreStandaloneInstaller::Callback callback =
base::Bind(
- &FileBrowserPrivateInstallWebstoreItemFunction::OnInstallComplete,
+ &FileManagerPrivateInstallWebstoreItemFunction::OnInstallComplete,
this);
// Only GoogleCastAPI extension can use silent installation.
return true;
}
-void FileBrowserPrivateInstallWebstoreItemFunction::OnInstallComplete(
+void FileManagerPrivateInstallWebstoreItemFunction::OnInstallComplete(
bool success,
const std::string& error,
extensions::webstore_install::Result result) {
SendResponse(success);
}
-FileBrowserPrivateRequestWebStoreAccessTokenFunction::
- FileBrowserPrivateRequestWebStoreAccessTokenFunction() {
+FileManagerPrivateRequestWebStoreAccessTokenFunction::
+ FileManagerPrivateRequestWebStoreAccessTokenFunction() {
}
-FileBrowserPrivateRequestWebStoreAccessTokenFunction::
- ~FileBrowserPrivateRequestWebStoreAccessTokenFunction() {
+FileManagerPrivateRequestWebStoreAccessTokenFunction::
+ ~FileManagerPrivateRequestWebStoreAccessTokenFunction() {
}
-bool FileBrowserPrivateRequestWebStoreAccessTokenFunction::RunAsync() {
+bool FileManagerPrivateRequestWebStoreAccessTokenFunction::RunAsync() {
std::vector<std::string> scopes;
scopes.push_back(kCWSScope);
url_request_context_getter,
scopes));
auth_service_->StartAuthentication(base::Bind(
- &FileBrowserPrivateRequestWebStoreAccessTokenFunction::
+ &FileManagerPrivateRequestWebStoreAccessTokenFunction::
OnAccessTokenFetched,
this));
return true;
}
-void FileBrowserPrivateRequestWebStoreAccessTokenFunction::OnAccessTokenFetched(
+void FileManagerPrivateRequestWebStoreAccessTokenFunction::OnAccessTokenFetched(
google_apis::GDataErrorCode code,
const std::string& access_token) {
drive::EventLogger* logger = file_manager::util::GetLogger(GetProfile());
}
}
-bool FileBrowserPrivateGetProfilesFunction::RunSync() {
- const std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >&
+bool FileManagerPrivateGetProfilesFunction::RunSync() {
+#if defined(USE_ATHENA)
+ // TODO(oshima): Figure out what to do.
+ return false;
+#endif
+
+ const std::vector<linked_ptr<api::file_manager_private::ProfileInfo> >&
profiles = GetLoggedInProfileInfoList();
// Obtains the display profile ID.
- apps::AppWindow* const app_window = GetCurrentAppWindow(this);
+ AppWindow* const app_window = GetCurrentAppWindow(this);
chrome::MultiUserWindowManager* const window_manager =
chrome::MultiUserWindowManager::GetInstance();
const std::string current_profile_id =
app_window->GetNativeWindow())
: "";
- results_ = api::file_browser_private::GetProfiles::Results::Create(
+ results_ = api::file_manager_private::GetProfiles::Results::Create(
profiles,
current_profile_id,
display_profile_id.empty() ? current_profile_id : display_profile_id);
return true;
}
-bool FileBrowserPrivateVisitDesktopFunction::RunSync() {
- using api::file_browser_private::VisitDesktop::Params;
+bool FileManagerPrivateVisitDesktopFunction::RunSync() {
+ using api::file_manager_private::VisitDesktop::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
- const std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >&
+ const std::vector<linked_ptr<api::file_manager_private::ProfileInfo> >&
profiles = GetLoggedInProfileInfoList();
chrome::MultiUserWindowManager* const window_manager =
}
// Look for the current app window.
- apps::AppWindow* const app_window = GetCurrentAppWindow(this);
+ AppWindow* const app_window = GetCurrentAppWindow(this);
if (!app_window) {
SetError("Target window is not found.");
return false;
}
- // Observe owner changes of windows.
- file_manager::EventRouter* const event_router =
- file_manager::FileBrowserPrivateAPI::Get(GetProfile())->event_router();
- event_router->RegisterMultiUserWindowManagerObserver();
-
// Move the window to the user's desktop.
window_manager->ShowWindowForUser(app_window->GetNativeWindow(),
params->profile_id);
return true;
}
-bool FileBrowserPrivateOpenInspectorFunction::RunSync() {
- using extensions::api::file_browser_private::OpenInspector::Params;
+bool FileManagerPrivateOpenInspectorFunction::RunSync() {
+ using extensions::api::file_manager_private::OpenInspector::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
switch (params->type) {
- case extensions::api::file_browser_private::INSPECTION_TYPE_NORMAL:
+ case extensions::api::file_manager_private::INSPECTION_TYPE_NORMAL:
// Open inspector for foreground page.
DevToolsWindow::OpenDevToolsWindow(
content::WebContents::FromRenderViewHost(render_view_host()));
break;
- case extensions::api::file_browser_private::INSPECTION_TYPE_CONSOLE:
+ case extensions::api::file_manager_private::INSPECTION_TYPE_CONSOLE:
// Open inspector for foreground page and bring focus to the console.
DevToolsWindow::OpenDevToolsWindow(
content::WebContents::FromRenderViewHost(render_view_host()),
DevToolsToggleAction::ShowConsole());
break;
- case extensions::api::file_browser_private::INSPECTION_TYPE_ELEMENT:
+ case extensions::api::file_manager_private::INSPECTION_TYPE_ELEMENT:
// Open inspector for foreground page in inspect element mode.
DevToolsWindow::OpenDevToolsWindow(
content::WebContents::FromRenderViewHost(render_view_host()),
DevToolsToggleAction::Inspect());
break;
- case extensions::api::file_browser_private::INSPECTION_TYPE_BACKGROUND:
+ case extensions::api::file_manager_private::INSPECTION_TYPE_BACKGROUND:
// Open inspector for background page.
extensions::devtools_util::InspectBackgroundPage(extension(),
GetProfile());