| 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" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 display_profile_id.empty() ? current_profile_id : display_profile_id); | 387 display_profile_id.empty() ? current_profile_id : display_profile_id); |
| 388 return true; | 388 return true; |
| 389 } | 389 } |
| 390 | 390 |
| 391 bool FileBrowserPrivateVisitDesktopFunction::RunSync() { | 391 bool FileBrowserPrivateVisitDesktopFunction::RunSync() { |
| 392 using api::file_browser_private::VisitDesktop::Params; | 392 using api::file_browser_private::VisitDesktop::Params; |
| 393 const scoped_ptr<Params> params(Params::Create(*args_)); | 393 const scoped_ptr<Params> params(Params::Create(*args_)); |
| 394 const std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >& | 394 const std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >& |
| 395 profiles = GetLoggedInProfileInfoList(GetAssociatedWebContents()); | 395 profiles = GetLoggedInProfileInfoList(GetAssociatedWebContents()); |
| 396 | 396 |
| 397 // Check the multi-profile support. | |
| 398 if (!profiles::IsMultipleProfilesEnabled()) { | |
| 399 SetError("Multi-profile support is not enabled."); | |
| 400 return false; | |
| 401 } | |
| 402 | |
| 403 chrome::MultiUserWindowManager* const window_manager = | 397 chrome::MultiUserWindowManager* const window_manager = |
| 404 chrome::MultiUserWindowManager::GetInstance(); | 398 chrome::MultiUserWindowManager::GetInstance(); |
| 405 DCHECK(window_manager); | 399 DCHECK(window_manager); |
| 406 | 400 |
| 407 // Check if the target user is logged-in or not. | 401 // Check if the target user is logged-in or not. |
| 408 bool logged_in = false; | 402 bool logged_in = false; |
| 409 for (size_t i = 0; i < profiles.size(); ++i) { | 403 for (size_t i = 0; i < profiles.size(); ++i) { |
| 410 if (profiles[i]->profile_id == params->profile_id) { | 404 if (profiles[i]->profile_id == params->profile_id) { |
| 411 logged_in = true; | 405 logged_in = true; |
| 412 break; | 406 break; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 437 if (!window_manager->IsWindowOnDesktopOfUser(app_window->GetNativeWindow(), | 431 if (!window_manager->IsWindowOnDesktopOfUser(app_window->GetNativeWindow(), |
| 438 params->profile_id)) { | 432 params->profile_id)) { |
| 439 SetError("The window cannot visit the desktop."); | 433 SetError("The window cannot visit the desktop."); |
| 440 return false; | 434 return false; |
| 441 } | 435 } |
| 442 | 436 |
| 443 return true; | 437 return true; |
| 444 } | 438 } |
| 445 | 439 |
| 446 } // namespace extensions | 440 } // namespace extensions |
| OLD | NEW |