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

Side by Side Diff: chrome/browser/extensions/api/feedback_private/feedback_private_api.cc

Issue 2065243002: Placing SRT Prompt on Feedback form behind Finch feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving to anonymous namespace Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/extensions/api/feedback_private/feedback_private_api.h" 5 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 14 matching lines...) Expand all
25 #include "components/feedback/tracing_manager.h" 25 #include "components/feedback/tracing_manager.h"
26 #include "components/signin/core/browser/signin_manager.h" 26 #include "components/signin/core/browser/signin_manager.h"
27 #include "content/public/browser/user_metrics.h" 27 #include "content/public/browser/user_metrics.h"
28 #include "extensions/browser/event_router.h" 28 #include "extensions/browser/event_router.h"
29 #include "grit/components_strings.h" 29 #include "grit/components_strings.h"
30 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
31 #include "ui/base/webui/web_ui_util.h" 31 #include "ui/base/webui/web_ui_util.h"
32 #include "url/url_util.h" 32 #include "url/url_util.h"
33 33
34 #if defined(OS_WIN) 34 #if defined(OS_WIN)
35 #include "base/feature_list.h"
35 #include "chrome/browser/safe_browsing/srt_fetcher_win.h" 36 #include "chrome/browser/safe_browsing/srt_fetcher_win.h"
37 #include "chrome/common/extensions/api/feedback_private.h"
afakhry 2016/06/27 19:59:53 Nit: Please remove this include. This file is alre
36 #endif 38 #endif
37 39
38 using extensions::api::feedback_private::SystemInformation; 40 using extensions::api::feedback_private::SystemInformation;
39 using feedback::FeedbackData; 41 using feedback::FeedbackData;
40 42
41 namespace { 43 namespace {
42 44
43 // Getting the filename of a blob prepends a "C:\fakepath" to the filename. 45 // Getting the filename of a blob prepends a "C:\fakepath" to the filename.
44 // This is undesirable, strip it if it exists. 46 // This is undesirable, strip it if it exists.
45 std::string StripFakepath(const std::string& path) { 47 std::string StripFakepath(const std::string& path) {
46 const char kFakePathStr[] = "C:\\fakepath\\"; 48 const char kFakePathStr[] = "C:\\fakepath\\";
47 if (base::StartsWith(path, kFakePathStr, 49 if (base::StartsWith(path, kFakePathStr,
48 base::CompareCase::INSENSITIVE_ASCII)) 50 base::CompareCase::INSENSITIVE_ASCII))
49 return path.substr(arraysize(kFakePathStr) - 1); 51 return path.substr(arraysize(kFakePathStr) - 1);
50 return path; 52 return path;
51 } 53 }
52 54
55 #if defined(OS_WIN)
56 // Allows enabling/disabling SRT Prompt as a Variations feature.
57 constexpr base::Feature kSrtPromptOnFeedbackForm {
58 "SrtPromptOnFeedbackForm", base::FEATURE_DISABLED_BY_DEFAULT
59 };
60 #endif
61
53 } // namespace 62 } // namespace
54 63
55 namespace extensions { 64 namespace extensions {
56 65
57 namespace feedback_private = api::feedback_private; 66 namespace feedback_private = api::feedback_private;
58 67
59 using feedback_private::SystemInformation; 68 using feedback_private::SystemInformation;
60 using feedback_private::FeedbackInfo; 69 using feedback_private::FeedbackInfo;
61 using feedback_private::FeedbackFlow; 70 using feedback_private::FeedbackFlow;
62 71
(...skipping 16 matching lines...) Expand all
79 } 88 }
80 89
81 FeedbackService* FeedbackPrivateAPI::GetService() const { 90 FeedbackService* FeedbackPrivateAPI::GetService() const {
82 return service_; 91 return service_;
83 } 92 }
84 93
85 void FeedbackPrivateAPI::RequestFeedback( 94 void FeedbackPrivateAPI::RequestFeedback(
86 const std::string& description_template, 95 const std::string& description_template,
87 const std::string& category_tag, 96 const std::string& category_tag,
88 const GURL& page_url) { 97 const GURL& page_url) {
98
afakhry 2016/06/27 19:59:53 Nit: Remove this line.
89 #if defined(OS_WIN) 99 #if defined(OS_WIN)
90 // Show prompt for Software Removal Tool if the Reporter component has found 100 // Show prompt for Software Removal Tool if the Reporter component has found
91 // unwanted software, and the user has never run the cleaner before. 101 // unwanted software, and the user has never run the cleaner before.
92 if (safe_browsing::ReporterFoundUws() && 102 if (base::FeatureList::IsEnabled(kSrtPromptOnFeedbackForm) &&
103 safe_browsing::ReporterFoundUws() &&
93 !safe_browsing::UserHasRunCleaner()) { 104 !safe_browsing::UserHasRunCleaner()) {
94 RequestFeedbackForFlow(description_template, category_tag, page_url, 105 RequestFeedbackForFlow(description_template, category_tag, page_url,
95 FeedbackFlow::FEEDBACK_FLOW_SHOWSRTPROMPT); 106 FeedbackFlow::FEEDBACK_FLOW_SHOWSRTPROMPT);
96 return; 107 return;
97 } 108 }
98 #endif 109 #endif
99
100 RequestFeedbackForFlow(description_template, category_tag, page_url, 110 RequestFeedbackForFlow(description_template, category_tag, page_url,
101 FeedbackFlow::FEEDBACK_FLOW_REGULAR); 111 FeedbackFlow::FEEDBACK_FLOW_REGULAR);
102 } 112 }
103 113
104 void FeedbackPrivateAPI::RequestFeedbackForFlow( 114 void FeedbackPrivateAPI::RequestFeedbackForFlow(
105 const std::string& description_template, 115 const std::string& description_template,
106 const std::string& category_tag, 116 const std::string& category_tag,
107 const GURL& page_url, 117 const GURL& page_url,
108 api::feedback_private::FeedbackFlow flow) { 118 api::feedback_private::FeedbackFlow flow) {
109 if (browser_context_ && EventRouter::Get(browser_context_)) { 119 if (browser_context_ && EventRouter::Get(browser_context_)) {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 content::RecordAction( 322 content::RecordAction(
313 base::UserMetricsAction("Feedback.SrtPromptClosed")); 323 base::UserMetricsAction("Feedback.SrtPromptClosed"));
314 break; 324 break;
315 default: 325 default:
316 return RespondNow(Error("Invalid arugment.")); 326 return RespondNow(Error("Invalid arugment."));
317 } 327 }
318 return RespondNow(NoArguments()); 328 return RespondNow(NoArguments());
319 } 329 }
320 330
321 } // namespace extensions 331 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698