| 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h" | 9 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 12 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 13 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 13 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 14 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 17 #include "chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.h" |
| 18 #include "chrome/common/chrome_switches.h" |
| 17 #include "components/signin/core/account_id/account_id.h" | 19 #include "components/signin/core/account_id/account_id.h" |
| 18 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 19 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 20 | 22 |
| 21 namespace { | 23 namespace { |
| 22 | 24 |
| 23 GURL GetTargetTabUrl(int session_id, int index) { | 25 GURL GetTargetTabUrl(int session_id, int index) { |
| 24 Browser* browser = chrome::FindBrowserWithID(session_id); | 26 Browser* browser = chrome::FindBrowserWithID(session_id); |
| 25 // Sanity checks. | 27 // Sanity checks. |
| 26 if (!browser || index >= browser->tab_strip_model()->count()) | 28 if (!browser || index >= browser->tab_strip_model()->count()) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 const AccountId display_account_id = | 73 const AccountId display_account_id = |
| 72 window_manager && browser | 74 window_manager && browser |
| 73 ? window_manager->GetUserPresentingWindow( | 75 ? window_manager->GetUserPresentingWindow( |
| 74 browser->window()->GetNativeWindow()) | 76 browser->window()->GetNativeWindow()) |
| 75 : EmptyAccountId(); | 77 : EmptyAccountId(); |
| 76 profile = display_account_id.is_valid() | 78 profile = display_account_id.is_valid() |
| 77 ? multi_user_util::GetProfileFromAccountId(display_account_id) | 79 ? multi_user_util::GetProfileFromAccountId(display_account_id) |
| 78 : profile; | 80 : profile; |
| 79 #endif | 81 #endif |
| 80 | 82 |
| 83 if (::switches::MdFeedbackEnabled()) { |
| 84 MdFeedbackDialogController::GetInstance()->Show(profile); |
| 85 return; |
| 86 } |
| 87 |
| 81 extensions::FeedbackPrivateAPI* api = | 88 extensions::FeedbackPrivateAPI* api = |
| 82 extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile); | 89 extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile); |
| 83 | 90 |
| 84 api->RequestFeedback(description_template, | 91 api->RequestFeedback(description_template, |
| 85 category_tag, | 92 category_tag, |
| 86 page_url); | 93 page_url); |
| 87 } | 94 } |
| 88 | 95 |
| 89 } // namespace chrome | 96 } // namespace chrome |
| OLD | NEW |