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

Side by Side Diff: extensions/browser/extension_warning_set.cc

Issue 503033002: Move ExtensionWarningService and ExtensionsWarningSet to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@3_web_view_internal
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extension_warning_set.h" 5 #include "extensions/browser/extension_warning_set.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/grit/chromium_strings.h"
12 #include "chrome/grit/generated_resources.h"
13 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
14 #include "extensions/common/extension.h" 11 #include "extensions/common/extension.h"
15 #include "extensions/common/extension_set.h" 12 #include "extensions/common/extension_set.h"
13 #include "extensions/common/extensions_client.h"
14 #include "extensions/strings/grit/extensions_strings.h"
16 #include "net/base/escape.h" 15 #include "net/base/escape.h"
17 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
18 17
19 using content::BrowserThread; 18 using content::BrowserThread;
20 19
21 namespace { 20 namespace {
22 // Prefix for message parameters indicating that the parameter needs to 21 // Prefix for message parameters indicating that the parameter needs to
23 // be translated from an extension id to the extension name. 22 // be translated from an extension id to the extension name.
24 const char kTranslate[] = "TO_TRANSLATE:"; 23 const char kTranslate[] = "TO_TRANSLATE:";
25 const size_t kMaxNumberOfParameters = 4; 24 const size_t kMaxNumberOfParameters = 4;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 extension_id_ = other.extension_id_; 60 extension_id_ = other.extension_id_;
62 message_id_ = other.message_id_; 61 message_id_ = other.message_id_;
63 message_parameters_ = other.message_parameters_; 62 message_parameters_ = other.message_parameters_;
64 return *this; 63 return *this;
65 } 64 }
66 65
67 // static 66 // static
68 ExtensionWarning ExtensionWarning::CreateNetworkDelayWarning( 67 ExtensionWarning ExtensionWarning::CreateNetworkDelayWarning(
69 const std::string& extension_id) { 68 const std::string& extension_id) {
70 std::vector<std::string> message_parameters; 69 std::vector<std::string> message_parameters;
71 message_parameters.push_back(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME)); 70 message_parameters.push_back(ExtensionsClient::Get()->GetProductName());
72 return ExtensionWarning( 71 return ExtensionWarning(
73 kNetworkDelay, 72 kNetworkDelay,
74 extension_id, 73 extension_id,
75 IDS_EXTENSION_WARNINGS_NETWORK_DELAY, 74 IDS_EXTENSION_WARNINGS_NETWORK_DELAY,
76 message_parameters); 75 message_parameters);
77 } 76 }
78 77
79 // static 78 // static
80 ExtensionWarning ExtensionWarning::CreateNetworkConflictWarning( 79 ExtensionWarning ExtensionWarning::CreateNetworkConflictWarning(
81 const std::string& extension_id) { 80 const std::string& extension_id) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 kNetworkConflict, 143 kNetworkConflict,
145 extension_id, 144 extension_id,
146 IDS_EXTENSION_WARNINGS_CREDENTIALS_CONFLICT, 145 IDS_EXTENSION_WARNINGS_CREDENTIALS_CONFLICT,
147 message_parameters); 146 message_parameters);
148 } 147 }
149 148
150 // static 149 // static
151 ExtensionWarning ExtensionWarning::CreateRepeatedCacheFlushesWarning( 150 ExtensionWarning ExtensionWarning::CreateRepeatedCacheFlushesWarning(
152 const std::string& extension_id) { 151 const std::string& extension_id) {
153 std::vector<std::string> message_parameters; 152 std::vector<std::string> message_parameters;
154 message_parameters.push_back(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME)); 153 message_parameters.push_back(ExtensionsClient::Get()->GetProductName());
155 return ExtensionWarning( 154 return ExtensionWarning(
156 kRepeatedCacheFlushes, 155 kRepeatedCacheFlushes,
157 extension_id, 156 extension_id,
158 IDS_EXTENSION_WARNINGS_NETWORK_DELAY, 157 IDS_EXTENSION_WARNINGS_NETWORK_DELAY,
159 message_parameters); 158 message_parameters);
160 } 159 }
161 160
162 // static 161 // static
163 ExtensionWarning ExtensionWarning::CreateDownloadFilenameConflictWarning( 162 ExtensionWarning ExtensionWarning::CreateDownloadFilenameConflictWarning(
164 const std::string& losing_extension_id, 163 const std::string& losing_extension_id,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 227 }
229 } 228 }
230 229
231 bool operator<(const ExtensionWarning& a, const ExtensionWarning& b) { 230 bool operator<(const ExtensionWarning& a, const ExtensionWarning& b) {
232 if (a.extension_id() != b.extension_id()) 231 if (a.extension_id() != b.extension_id())
233 return a.extension_id() < b.extension_id(); 232 return a.extension_id() < b.extension_id();
234 return a.warning_type() < b.warning_type(); 233 return a.warning_type() < b.warning_type();
235 } 234 }
236 235
237 } // namespace extensions 236 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698