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