| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_COMMON_LOCALIZED_ERROR_H_ | 5 #ifndef CHROME_COMMON_LOCALIZED_ERROR_H_ |
| 6 #define CHROME_COMMON_LOCALIZED_ERROR_H_ | 6 #define CHROME_COMMON_LOCALIZED_ERROR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace WebKit { | 23 namespace WebKit { |
| 24 struct WebURLError; | 24 struct WebURLError; |
| 25 } | 25 } |
| 26 | 26 |
| 27 class LocalizedError { | 27 class LocalizedError { |
| 28 public: | 28 public: |
| 29 // Fills |error_strings| with values to be used to build an error page used | 29 // Fills |error_strings| with values to be used to build an error page used |
| 30 // on HTTP errors, like 404 or connection reset. | 30 // on HTTP errors, like 404 or connection reset. |
| 31 static void GetStrings(const WebKit::WebURLError& error, | 31 static void GetStrings(const WebKit::WebURLError& error, |
| 32 bool is_post, | 32 base::DictionaryValue* strings, |
| 33 const std::string& locale, | 33 const std::string& locale); |
| 34 base::DictionaryValue* strings); | |
| 35 | 34 |
| 36 // Returns a description of the encountered error. | 35 // Returns a description of the encountered error. |
| 37 static string16 GetErrorDetails(const WebKit::WebURLError& error, | 36 static string16 GetErrorDetails(const WebKit::WebURLError& error); |
| 38 bool is_post); | |
| 39 | 37 |
| 40 // Returns true if an error page exists for the specified parameters. | 38 // Returns true if an error page exists for the specified parameters. |
| 41 static bool HasStrings(const std::string& error_domain, int error_code); | 39 static bool HasStrings(const std::string& error_domain, int error_code); |
| 42 | 40 |
| 41 // Fills |error_strings| with values to be used to build an error page which |
| 42 // warns against reposting form data. This is special cased because the form |
| 43 // repost "error page" has no real error associated with it, and doesn't have |
| 44 // enough strings localized to meaningfully fill the net error template. |
| 45 // TODO(mmenke): Get rid of this and merge with GetStrings. |
| 46 static void GetFormRepostStrings(const GURL& display_url, |
| 47 base::DictionaryValue* error_strings); |
| 48 |
| 43 // Fills |error_strings| with values to be used to build an error page used | 49 // Fills |error_strings| with values to be used to build an error page used |
| 44 // on HTTP errors, like 404 or connection reset, but using information from | 50 // on HTTP errors, like 404 or connection reset, but using information from |
| 45 // the associated |app| in order to make the error page look like it's more | 51 // the associated |app| in order to make the error page look like it's more |
| 46 // part of the app. | 52 // part of the app. |
| 47 static void GetAppErrorStrings(const WebKit::WebURLError& error, | 53 static void GetAppErrorStrings(const WebKit::WebURLError& error, |
| 48 const GURL& display_url, | 54 const GURL& display_url, |
| 49 const extensions::Extension* app, | 55 const extensions::Extension* app, |
| 50 base::DictionaryValue* error_strings); | 56 base::DictionaryValue* error_strings); |
| 51 | 57 |
| 52 static const char kHttpErrorDomain[]; | 58 static const char kHttpErrorDomain[]; |
| 53 | 59 |
| 54 private: | 60 private: |
| 55 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalizedError); | 61 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalizedError); |
| 56 }; | 62 }; |
| 57 | 63 |
| 58 #endif // CHROME_COMMON_LOCALIZED_ERROR_H_ | 64 #endif // CHROME_COMMON_LOCALIZED_ERROR_H_ |
| OLD | NEW |