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/command_line.h" | |
10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
11 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chromeos/drive/file_system_util.h" | 15 #include "chrome/browser/chromeos/drive/file_system_util.h" |
15 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" | 16 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" |
16 #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" |
17 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 18 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
18 #include "chrome/browser/chromeos/file_manager/app_installer.h" | 19 #include "chrome/browser/chromeos/file_manager/app_installer.h" |
19 #include "chrome/browser/chromeos/file_manager/zip_file_creator.h" | 20 #include "chrome/browser/chromeos/file_manager/zip_file_creator.h" |
20 #include "chrome/browser/chromeos/login/users/user_manager.h" | 21 #include "chrome/browser/chromeos/login/users/user_manager.h" |
21 #include "chrome/browser/chromeos/settings/cros_settings.h" | 22 #include "chrome/browser/chromeos/settings/cros_settings.h" |
23 #include "chrome/browser/devtools/devtools_window.h" | |
22 #include "chrome/browser/drive/event_logger.h" | 24 #include "chrome/browser/drive/event_logger.h" |
25 #include "chrome/browser/extensions/devtools_util.h" | |
23 #include "chrome/browser/lifetime/application_lifetime.h" | 26 #include "chrome/browser/lifetime/application_lifetime.h" |
24 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
26 #include "chrome/browser/profiles/profiles_state.h" | 29 #include "chrome/browser/profiles/profiles_state.h" |
27 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 30 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
28 #include "chrome/browser/signin/signin_manager_factory.h" | 31 #include "chrome/browser/signin/signin_manager_factory.h" |
29 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 32 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
30 #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" |
34 #include "chrome/common/chrome_switches.h" | |
31 #include "chrome/common/extensions/api/file_browser_private.h" | 35 #include "chrome/common/extensions/api/file_browser_private.h" |
32 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
33 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 37 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
34 #include "components/signin/core/browser/signin_manager.h" | 38 #include "components/signin/core/browser/signin_manager.h" |
35 #include "content/public/browser/render_view_host.h" | 39 #include "content/public/browser/render_view_host.h" |
36 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" |
37 #include "content/public/common/page_zoom.h" | 41 #include "content/public/common/page_zoom.h" |
38 #include "google_apis/drive/auth_service.h" | 42 #include "google_apis/drive/auth_service.h" |
39 #include "ui/base/webui/web_ui_util.h" | 43 #include "ui/base/webui/web_ui_util.h" |
40 #include "url/gurl.h" | 44 #include "url/gurl.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 // Check the result. | 434 // Check the result. |
431 if (!window_manager->IsWindowOnDesktopOfUser(app_window->GetNativeWindow(), | 435 if (!window_manager->IsWindowOnDesktopOfUser(app_window->GetNativeWindow(), |
432 params->profile_id)) { | 436 params->profile_id)) { |
433 SetError("The window cannot visit the desktop."); | 437 SetError("The window cannot visit the desktop."); |
434 return false; | 438 return false; |
435 } | 439 } |
436 | 440 |
437 return true; | 441 return true; |
438 } | 442 } |
439 | 443 |
444 bool FileBrowserPrivateOpenInspectorFunction::RunSync() { | |
445 // This method doesn't have any effect if the flag 'debug-packed-apps' is not | |
446 // enabled. | |
447 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDebugPackedApps)) | |
448 return true; | |
449 | |
450 using extensions::api::file_browser_private::OpenInspector::Params; | |
451 const scoped_ptr<Params> params(Params::Create(*args_)); | |
452 EXTENSION_FUNCTION_VALIDATE(params); | |
453 | |
454 switch (params->type) { | |
455 case extensions::api::file_browser_private::INSPECTION_TYPE_NORMAL: | |
456 // Open inspector for foreground page. | |
457 DevToolsWindow::OpenDevToolsWindow(render_view_host()); | |
458 break; | |
459 case extensions::api::file_browser_private::INSPECTION_TYPE_CONSOLE: | |
460 // Open inspector for foreground page and focus to console tab. | |
461 DevToolsWindow::OpenDevToolsWindow(render_view_host(), | |
462 DevToolsToggleAction::ShowConsole()); | |
463 break; | |
464 case extensions::api::file_browser_private::INSPECTION_TYPE_ELEMENT: | |
465 // Open inspector for foreground page and focus to element tab. | |
466 DevToolsWindow::OpenDevToolsWindow(render_view_host(), | |
467 DevToolsToggleAction::Inspect()); | |
468 break; | |
469 case extensions::api::file_browser_private::INSPECTION_TYPE_BACKGROUND: | |
470 // Open inspector for background page. | |
471 extensions::devtools_util::InspectBackgroundPage(GetExtension(), | |
472 GetProfile()); | |
473 break; | |
474 default: | |
475 NOTREACHED(); | |
yoshiki
2014/05/23 06:22:16
nit: please set an error with SetError() method.
fukino
2014/05/23 06:54:31
Done.
| |
476 return false; | |
477 } | |
478 return true; | |
479 } | |
480 | |
440 } // namespace extensions | 481 } // namespace extensions |
OLD | NEW |