Home | History | Annotate | Download | only in common
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef EXTENSIONS_COMMON_INSTALL_WARNING_H_
      6 #define EXTENSIONS_COMMON_INSTALL_WARNING_H_
      7 
      8 #include <ostream>
      9 #include <string>
     10 
     11 namespace extensions {
     12 
     13 struct InstallWarning {
     14   enum Format {
     15     // IMPORTANT: Do not build HTML strings from user or developer-supplied
     16     // input.
     17     FORMAT_TEXT,
     18     FORMAT_HTML,
     19   };
     20   static InstallWarning Text(const std::string& message) {
     21     return InstallWarning(FORMAT_TEXT, message);
     22   }
     23   InstallWarning(Format format, const std::string& message)
     24       : format(format), message(message) {
     25   }
     26   bool operator==(const InstallWarning& other) const {
     27     return format == other.format && message == other.message;
     28   }
     29   Format format;
     30   std::string message;
     31 };
     32 
     33 // Let gtest print InstallWarnings.
     34 void PrintTo(const InstallWarning&, ::std::ostream* os);
     35 
     36 }  // namespace
     37 
     38 #endif  // EXTENSIONS_COMMON_INSTALL_WARNING_H_
     39