summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authoryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-31 08:41:40 +0000
committeryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-31 08:41:40 +0000
commit1d5e58b96403aab76b4ae9f957eac7fac9c54182 (patch)
tree531272d9e76d671eee55318d5cd75da120e8a277 /extensions
parent13fb3ec6e5f257683426c353f70523b1ad2e24f7 (diff)
downloadchromium_src-1d5e58b96403aab76b4ae9f957eac7fac9c54182.zip
chromium_src-1d5e58b96403aab76b4ae9f957eac7fac9c54182.tar.gz
chromium_src-1d5e58b96403aab76b4ae9f957eac7fac9c54182.tar.bz2
Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file.
Reverses the dependency between Extension and Manifest. Part 1 of moving Manifest to top-level extensions. BUG=162530 TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/12093036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions')
-rw-r--r--extensions/common/install_warning.cc24
-rw-r--r--extensions/common/install_warning.h35
2 files changed, 59 insertions, 0 deletions
diff --git a/extensions/common/install_warning.cc b/extensions/common/install_warning.cc
new file mode 100644
index 0000000..c632a71
--- /dev/null
+++ b/extensions/common/install_warning.cc
@@ -0,0 +1,24 @@
+// Copyright (c) 2013 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 "extensions/common/install_warning.h"
+
+namespace extensions {
+
+void PrintTo(const InstallWarning& warning, ::std::ostream* os) {
+ *os << "InstallWarning(";
+ switch (warning.format) {
+ case InstallWarning::FORMAT_TEXT:
+ *os << "FORMAT_TEXT, \"";
+ break;
+ case InstallWarning::FORMAT_HTML:
+ *os << "FORMAT_HTML, \"";
+ break;
+ }
+ // This is just for test error messages, so no need to escape '"'
+ // characters inside the message.
+ *os << warning.message << "\")";
+}
+
+} // namespace extensions
diff --git a/extensions/common/install_warning.h b/extensions/common/install_warning.h
new file mode 100644
index 0000000..6a2cb65
--- /dev/null
+++ b/extensions/common/install_warning.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2013 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.
+
+#ifndef EXTENSIONS_COMMON_INSTALL_WARNING_H_
+#define EXTENSIONS_COMMON_INSTALL_WARNING_H_
+
+#include <ostream>
+#include <string>
+
+namespace extensions {
+
+struct InstallWarning {
+ enum Format {
+ // IMPORTANT: Do not build HTML strings from user or developer-supplied
+ // input.
+ FORMAT_TEXT,
+ FORMAT_HTML,
+ };
+ InstallWarning(Format format, const std::string& message)
+ : format(format), message(message) {
+ }
+ bool operator==(const InstallWarning& other) const {
+ return format == other.format && message == other.message;
+ }
+ Format format;
+ std::string message;
+};
+
+// Let gtest print InstallWarnings.
+void PrintTo(const InstallWarning&, ::std::ostream* os);
+
+} // namespace
+
+#endif // EXTENSIONS_COMMON_INSTALL_WARNING_H_