| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h" | 8 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 Profile* profile = NULL; | 52 Profile* profile = NULL; |
| 53 if (browser) { | 53 if (browser) { |
| 54 profile = browser->profile(); | 54 profile = browser->profile(); |
| 55 } else { | 55 } else { |
| 56 profile = ProfileManager::GetLastUsedProfileAllowedByPolicy(); | 56 profile = ProfileManager::GetLastUsedProfileAllowedByPolicy(); |
| 57 } | 57 } |
| 58 if (!profile) { | 58 if (!profile) { |
| 59 LOG(ERROR) << "Cannot invoke feedback: No profile found!"; | 59 LOG(ERROR) << "Cannot invoke feedback: No profile found!"; |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 if (profile->IsGuestSession()) { |
| 63 profile = g_browser_process->profile_manager()-> |
| 64 GetProfile(ProfileManager::GetSystemProfilePath()); |
| 65 } |
| 62 | 66 |
| 63 // We do not want to launch on an OTR profile. | 67 // We do not want to launch on an OTR profile. |
| 64 profile = profile->GetOriginalProfile(); | 68 profile = profile->GetOriginalProfile(); |
| 65 DCHECK(profile); | 69 DCHECK(profile); |
| 66 | 70 |
| 67 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
| 68 // Obtains the display profile ID on which the Feedback window should show. | 72 // Obtains the display profile ID on which the Feedback window should show. |
| 69 chrome::MultiUserWindowManager* const window_manager = | 73 chrome::MultiUserWindowManager* const window_manager = |
| 70 chrome::MultiUserWindowManager::GetInstance(); | 74 chrome::MultiUserWindowManager::GetInstance(); |
| 71 const std::string display_profile_id = | 75 const std::string display_profile_id = |
| 72 window_manager && browser | 76 window_manager && browser |
| 73 ? window_manager->GetUserPresentingWindow( | 77 ? window_manager->GetUserPresentingWindow( |
| 74 browser->window()->GetNativeWindow()) | 78 browser->window()->GetNativeWindow()) |
| 75 : ""; | 79 : ""; |
| 76 profile = display_profile_id.empty() | 80 profile = display_profile_id.empty() |
| 77 ? profile | 81 ? profile |
| 78 : multi_user_util::GetProfileFromUserID(display_profile_id); | 82 : multi_user_util::GetProfileFromUserID(display_profile_id); |
| 79 #endif | 83 #endif |
| 80 | 84 |
| 81 extensions::FeedbackPrivateAPI* api = | 85 extensions::FeedbackPrivateAPI* api = |
| 82 extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile); | 86 extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile); |
| 83 | 87 |
| 84 api->RequestFeedback(description_template, | 88 api->RequestFeedback(description_template, |
| 85 category_tag, | 89 category_tag, |
| 86 page_url); | 90 page_url); |
| 87 } | 91 } |
| 88 | 92 |
| 89 } // namespace chrome | 93 } // namespace chrome |
| OLD | NEW |