OLD | NEW |
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 Loading... |
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" |
36 #endif | 37 #endif |
37 | 38 |
38 using extensions::api::feedback_private::SystemInformation; | 39 using extensions::api::feedback_private::SystemInformation; |
39 using feedback::FeedbackData; | 40 using feedback::FeedbackData; |
40 | 41 |
41 namespace { | 42 namespace { |
42 | 43 |
43 // Getting the filename of a blob prepends a "C:\fakepath" to the filename. | 44 // Getting the filename of a blob prepends a "C:\fakepath" to the filename. |
44 // This is undesirable, strip it if it exists. | 45 // This is undesirable, strip it if it exists. |
45 std::string StripFakepath(const std::string& path) { | 46 std::string StripFakepath(const std::string& path) { |
46 const char kFakePathStr[] = "C:\\fakepath\\"; | 47 const char kFakePathStr[] = "C:\\fakepath\\"; |
47 if (base::StartsWith(path, kFakePathStr, | 48 if (base::StartsWith(path, kFakePathStr, |
48 base::CompareCase::INSENSITIVE_ASCII)) | 49 base::CompareCase::INSENSITIVE_ASCII)) |
49 return path.substr(arraysize(kFakePathStr) - 1); | 50 return path.substr(arraysize(kFakePathStr) - 1); |
50 return path; | 51 return path; |
51 } | 52 } |
52 | 53 |
| 54 #if defined(OS_WIN) |
| 55 // Allows enabling/disabling SRT Prompt as a Variations feature. |
| 56 constexpr base::Feature kSrtPromptOnFeedbackForm { |
| 57 "SrtPromptOnFeedbackForm", base::FEATURE_DISABLED_BY_DEFAULT |
| 58 }; |
| 59 #endif |
| 60 |
53 } // namespace | 61 } // namespace |
54 | 62 |
55 namespace extensions { | 63 namespace extensions { |
56 | 64 |
57 namespace feedback_private = api::feedback_private; | 65 namespace feedback_private = api::feedback_private; |
58 | 66 |
59 using feedback_private::SystemInformation; | 67 using feedback_private::SystemInformation; |
60 using feedback_private::FeedbackInfo; | 68 using feedback_private::FeedbackInfo; |
61 using feedback_private::FeedbackFlow; | 69 using feedback_private::FeedbackFlow; |
62 | 70 |
(...skipping 19 matching lines...) Expand all Loading... |
82 return service_; | 90 return service_; |
83 } | 91 } |
84 | 92 |
85 void FeedbackPrivateAPI::RequestFeedback( | 93 void FeedbackPrivateAPI::RequestFeedback( |
86 const std::string& description_template, | 94 const std::string& description_template, |
87 const std::string& category_tag, | 95 const std::string& category_tag, |
88 const GURL& page_url) { | 96 const GURL& page_url) { |
89 #if defined(OS_WIN) | 97 #if defined(OS_WIN) |
90 // Show prompt for Software Removal Tool if the Reporter component has found | 98 // Show prompt for Software Removal Tool if the Reporter component has found |
91 // unwanted software, and the user has never run the cleaner before. | 99 // unwanted software, and the user has never run the cleaner before. |
92 if (safe_browsing::ReporterFoundUws() && | 100 if (base::FeatureList::IsEnabled(kSrtPromptOnFeedbackForm) && |
| 101 safe_browsing::ReporterFoundUws() && |
93 !safe_browsing::UserHasRunCleaner()) { | 102 !safe_browsing::UserHasRunCleaner()) { |
94 RequestFeedbackForFlow(description_template, category_tag, page_url, | 103 RequestFeedbackForFlow(description_template, category_tag, page_url, |
95 FeedbackFlow::FEEDBACK_FLOW_SHOWSRTPROMPT); | 104 FeedbackFlow::FEEDBACK_FLOW_SHOWSRTPROMPT); |
96 return; | 105 return; |
97 } | 106 } |
98 #endif | 107 #endif |
99 | |
100 RequestFeedbackForFlow(description_template, category_tag, page_url, | 108 RequestFeedbackForFlow(description_template, category_tag, page_url, |
101 FeedbackFlow::FEEDBACK_FLOW_REGULAR); | 109 FeedbackFlow::FEEDBACK_FLOW_REGULAR); |
102 } | 110 } |
103 | 111 |
104 void FeedbackPrivateAPI::RequestFeedbackForFlow( | 112 void FeedbackPrivateAPI::RequestFeedbackForFlow( |
105 const std::string& description_template, | 113 const std::string& description_template, |
106 const std::string& category_tag, | 114 const std::string& category_tag, |
107 const GURL& page_url, | 115 const GURL& page_url, |
108 api::feedback_private::FeedbackFlow flow) { | 116 api::feedback_private::FeedbackFlow flow) { |
109 if (browser_context_ && EventRouter::Get(browser_context_)) { | 117 if (browser_context_ && EventRouter::Get(browser_context_)) { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 content::RecordAction( | 320 content::RecordAction( |
313 base::UserMetricsAction("Feedback.SrtPromptClosed")); | 321 base::UserMetricsAction("Feedback.SrtPromptClosed")); |
314 break; | 322 break; |
315 default: | 323 default: |
316 return RespondNow(Error("Invalid arugment.")); | 324 return RespondNow(Error("Invalid arugment.")); |
317 } | 325 } |
318 return RespondNow(NoArguments()); | 326 return RespondNow(NoArguments()); |
319 } | 327 } |
320 | 328 |
321 } // namespace extensions | 329 } // namespace extensions |
OLD | NEW |