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" |
11 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 11 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
12 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 12 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 16 #include "components/signin/core/account_id/account_id.h" |
16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 GURL GetTargetTabUrl(int session_id, int index) { | 22 GURL GetTargetTabUrl(int session_id, int index) { |
22 Browser* browser = chrome::FindBrowserWithID(session_id); | 23 Browser* browser = chrome::FindBrowserWithID(session_id); |
23 // Sanity checks. | 24 // Sanity checks. |
24 if (!browser || index >= browser->tab_strip_model()->count()) | 25 if (!browser || index >= browser->tab_strip_model()->count()) |
25 return GURL(); | 26 return GURL(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 60 } |
60 | 61 |
61 // We do not want to launch on an OTR profile. | 62 // We do not want to launch on an OTR profile. |
62 profile = profile->GetOriginalProfile(); | 63 profile = profile->GetOriginalProfile(); |
63 DCHECK(profile); | 64 DCHECK(profile); |
64 | 65 |
65 #if defined(OS_CHROMEOS) | 66 #if defined(OS_CHROMEOS) |
66 // Obtains the display profile ID on which the Feedback window should show. | 67 // Obtains the display profile ID on which the Feedback window should show. |
67 chrome::MultiUserWindowManager* const window_manager = | 68 chrome::MultiUserWindowManager* const window_manager = |
68 chrome::MultiUserWindowManager::GetInstance(); | 69 chrome::MultiUserWindowManager::GetInstance(); |
69 const std::string display_profile_id = | 70 const AccountId display_account_id = |
70 window_manager && browser | 71 window_manager && browser |
71 ? window_manager->GetUserPresentingWindow( | 72 ? window_manager->GetUserPresentingWindow( |
72 browser->window()->GetNativeWindow()) | 73 browser->window()->GetNativeWindow()) |
73 : ""; | 74 : EmptyAccountId(); |
74 profile = display_profile_id.empty() | 75 profile = display_account_id.is_valid() |
75 ? profile | 76 ? multi_user_util::GetProfileFromAccountId(display_account_id) |
76 : multi_user_util::GetProfileFromUserID(display_profile_id); | 77 : profile; |
77 #endif | 78 #endif |
78 | 79 |
79 extensions::FeedbackPrivateAPI* api = | 80 extensions::FeedbackPrivateAPI* api = |
80 extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile); | 81 extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile); |
81 | 82 |
82 api->RequestFeedback(description_template, | 83 api->RequestFeedback(description_template, |
83 category_tag, | 84 category_tag, |
84 page_url); | 85 page_url); |
85 } | 86 } |
86 | 87 |
87 } // namespace chrome | 88 } // namespace chrome |
OLD | NEW |