Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1961)

Unified Diff: chrome/browser/feedback/feedback_dialog_utils.cc

Issue 2190653003: [Md Feedback] Add initial data population for dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/feedback/feedback_dialog_utils.cc
diff --git a/chrome/browser/feedback/show_feedback_page.cc b/chrome/browser/feedback/feedback_dialog_utils.cc
similarity index 62%
copy from chrome/browser/feedback/show_feedback_page.cc
copy to chrome/browser/feedback/feedback_dialog_utils.cc
index 0c04809ebb0fd6ce89b219d38deaee5dbdc6da7e..ffa4c621b7a475298498e2487c101366636f8994 100644
--- a/chrome/browser/feedback/show_feedback_page.cc
+++ b/chrome/browser/feedback/feedback_dialog_utils.cc
@@ -1,26 +1,25 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <string>
+#include "chrome/browser/feedback/feedback_dialog_utils.h"
-#include "build/build_config.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
-#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/browser/ui/webui/md_feedback/md_feedback_dialog_controller.h"
-#include "chrome/common/chrome_switches.h"
-#include "components/signin/core/account_id/account_id.h"
#include "content/public/browser/web_contents.h"
#include "url/gurl.h"
-namespace {
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
+#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "components/signin/core/account_id/account_id.h"
+#endif
+
+namespace chrome {
GURL GetTargetTabUrl(int session_id, int index) {
Browser* browser = chrome::FindBrowserWithID(session_id);
@@ -38,29 +37,15 @@ GURL GetTargetTabUrl(int session_id, int index) {
return GURL();
}
-} // namespace
-
-namespace chrome {
-
-void ShowFeedbackPage(Browser* browser,
- const std::string& description_template,
- const std::string& category_tag) {
- GURL page_url;
- if (browser) {
- page_url = GetTargetTabUrl(browser->session_id().id(),
- browser->tab_strip_model()->active_index());
- }
-
+Profile* GetFeedbackProfile(Browser* browser) {
Profile* profile = NULL;
afakhry 2016/09/14 01:48:15 nullptr.
apacible 2016/09/14 17:53:19 Done.
if (browser) {
afakhry 2016/09/14 01:48:15 Nit: please remove curly braces from single-line i
apacible 2016/09/14 17:53:19 Done.
profile = browser->profile();
} else {
profile = ProfileManager::GetLastUsedProfileAllowedByPolicy();
}
- if (!profile) {
- LOG(ERROR) << "Cannot invoke feedback: No profile found!";
- return;
- }
+ if (!profile)
+ return NULL;
afakhry 2016/09/14 01:48:15 nullptr.
apacible 2016/09/14 17:53:20 Done.
// We do not want to launch on an OTR profile.
profile = profile->GetOriginalProfile();
@@ -79,18 +64,7 @@ void ShowFeedbackPage(Browser* browser,
? multi_user_util::GetProfileFromAccountId(display_account_id)
: profile;
afakhry 2016/09/14 01:48:15 This, however, is more suitable for an if(), since
apacible 2016/09/14 17:53:20 Done.
#endif
-
- if (::switches::MdFeedbackEnabled()) {
- MdFeedbackDialogController::GetInstance()->Show(profile);
- return;
- }
-
- extensions::FeedbackPrivateAPI* api =
- extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile);
-
- api->RequestFeedback(description_template,
- category_tag,
- page_url);
+ return profile;
}
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698