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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 // Make a ProfileInfo. | 84 // Make a ProfileInfo. |
85 linked_ptr<api::file_browser_private::ProfileInfo> profile_info( | 85 linked_ptr<api::file_browser_private::ProfileInfo> profile_info( |
86 new api::file_browser_private::ProfileInfo()); | 86 new api::file_browser_private::ProfileInfo()); |
87 profile_info->profile_id = multi_user_util::GetUserIDFromProfile(profile); | 87 profile_info->profile_id = multi_user_util::GetUserIDFromProfile(profile); |
88 profile_info->display_name = UTF16ToUTF8(user->GetDisplayName()); | 88 profile_info->display_name = UTF16ToUTF8(user->GetDisplayName()); |
89 // TODO(hirono): Remove the property from the profile_info. | 89 // TODO(hirono): Remove the property from the profile_info. |
90 profile_info->is_current_profile = true; | 90 profile_info->is_current_profile = true; |
91 | 91 |
92 // Make an icon URL of the profile. | 92 // Make an icon URL of the profile. |
| 93 #if !defined(USE_ATHENA) |
| 94 // TODO(oshima): Move GetAvatarImageForContext out from ash. |
| 95 // crbug.com/408748. |
93 if (contents) { | 96 if (contents) { |
94 const gfx::Image& image = | 97 const gfx::Image& image = |
95 ash::GetAvatarImageForContext(contents->GetBrowserContext()); | 98 ash::GetAvatarImageForContext(contents->GetBrowserContext()); |
96 const gfx::ImageSkia& skia = image.AsImageSkia(); | 99 const gfx::ImageSkia& skia = image.AsImageSkia(); |
97 profile_info->profile_image.reset( | 100 profile_info->profile_image.reset( |
98 new api::file_browser_private::ImageSet); | 101 new api::file_browser_private::ImageSet); |
99 profile_info->profile_image->scale1x_url = | 102 profile_info->profile_image->scale1x_url = |
100 webui::GetBitmapDataUrl(skia.GetRepresentation(1.0f).sk_bitmap()); | 103 webui::GetBitmapDataUrl(skia.GetRepresentation(1.0f).sk_bitmap()); |
101 profile_info->profile_image->scale2x_url = | 104 profile_info->profile_image->scale2x_url = |
102 webui::GetBitmapDataUrl(skia.GetRepresentation(2.0f).sk_bitmap()); | 105 webui::GetBitmapDataUrl(skia.GetRepresentation(2.0f).sk_bitmap()); |
103 } | 106 } |
| 107 #endif |
104 result_profiles.push_back(profile_info); | 108 result_profiles.push_back(profile_info); |
105 } | 109 } |
106 | 110 |
107 return result_profiles; | 111 return result_profiles; |
108 } | 112 } |
109 } // namespace | 113 } // namespace |
110 | 114 |
111 bool FileBrowserPrivateLogoutUserForReauthenticationFunction::RunSync() { | 115 bool FileBrowserPrivateLogoutUserForReauthenticationFunction::RunSync() { |
112 user_manager::User* user = | 116 user_manager::User* user = |
113 chromeos::ProfileHelper::Get()->GetUserByProfile(GetProfile()); | 117 chromeos::ProfileHelper::Get()->GetUserByProfile(GetProfile()); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 SendResponse(false); | 381 SendResponse(false); |
378 } | 382 } |
379 } | 383 } |
380 | 384 |
381 bool FileBrowserPrivateGetProfilesFunction::RunSync() { | 385 bool FileBrowserPrivateGetProfilesFunction::RunSync() { |
382 const std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >& | 386 const std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >& |
383 profiles = GetLoggedInProfileInfoList(GetAssociatedWebContents()); | 387 profiles = GetLoggedInProfileInfoList(GetAssociatedWebContents()); |
384 | 388 |
385 // Obtains the display profile ID. | 389 // Obtains the display profile ID. |
386 apps::AppWindow* const app_window = GetCurrentAppWindow(this); | 390 apps::AppWindow* const app_window = GetCurrentAppWindow(this); |
| 391 |
| 392 #if defined(USE_ATHENA) |
| 393 // TODO(oshima): Figure out what to do. |
| 394 return false; |
| 395 #endif |
| 396 |
387 chrome::MultiUserWindowManager* const window_manager = | 397 chrome::MultiUserWindowManager* const window_manager = |
388 chrome::MultiUserWindowManager::GetInstance(); | 398 chrome::MultiUserWindowManager::GetInstance(); |
389 const std::string current_profile_id = | 399 const std::string current_profile_id = |
390 multi_user_util::GetUserIDFromProfile(GetProfile()); | 400 multi_user_util::GetUserIDFromProfile(GetProfile()); |
391 const std::string display_profile_id = | 401 const std::string display_profile_id = |
392 window_manager && app_window ? window_manager->GetUserPresentingWindow( | 402 window_manager && app_window ? window_manager->GetUserPresentingWindow( |
393 app_window->GetNativeWindow()) | 403 app_window->GetNativeWindow()) |
394 : ""; | 404 : ""; |
395 | 405 |
396 results_ = api::file_browser_private::GetProfiles::Results::Create( | 406 results_ = api::file_browser_private::GetProfiles::Results::Create( |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 NOTREACHED(); | 491 NOTREACHED(); |
482 SetError( | 492 SetError( |
483 base::StringPrintf("Unexpected inspection type(%d) is specified.", | 493 base::StringPrintf("Unexpected inspection type(%d) is specified.", |
484 static_cast<int>(params->type))); | 494 static_cast<int>(params->type))); |
485 return false; | 495 return false; |
486 } | 496 } |
487 return true; | 497 return true; |
488 } | 498 } |
489 | 499 |
490 } // namespace extensions | 500 } // namespace extensions |
OLD | NEW |