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_RENDERER_LOCALIZED_ERROR_H_ | 5 #ifndef CHROME_COMMON_LOCALIZED_ERROR_H_ |
6 #define CHROME_RENDERER_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" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 | 12 |
13 class GURL; | 13 class GURL; |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class DictionaryValue; | 16 class DictionaryValue; |
17 } | 17 } |
18 | 18 |
19 namespace extensions { | 19 namespace extensions { |
20 class Extension; | 20 class Extension; |
21 } | 21 } |
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 // Because Chrome for iOS uses LocalizedError but does not include the renderer | |
29 // thread, this class needs to be in a commonly accessible directory. | |
Nico
2012/08/08 17:56:07
Remove comment
mirandac
2012/08/08 17:59:28
Done.
| |
30 | |
28 public: | 31 public: |
29 // Fills |error_strings| with values to be used to build an error page used | 32 // Fills |error_strings| with values to be used to build an error page used |
30 // on HTTP errors, like 404 or connection reset. | 33 // on HTTP errors, like 404 or connection reset. |
31 static void GetStrings(const WebKit::WebURLError& error, | 34 static void GetStrings(const WebKit::WebURLError& error, |
32 base::DictionaryValue* strings); | 35 base::DictionaryValue* strings, |
36 const std::string& locale); | |
33 | 37 |
34 // Returns a description of the encountered error. | 38 // Returns a description of the encountered error. |
35 static string16 GetErrorDetails(const WebKit::WebURLError& error); | 39 static string16 GetErrorDetails(const WebKit::WebURLError& error); |
36 | 40 |
37 // Returns true if an error page exists for the specified parameters. | 41 // Returns true if an error page exists for the specified parameters. |
38 static bool HasStrings(const std::string& error_domain, int error_code); | 42 static bool HasStrings(const std::string& error_domain, int error_code); |
39 | 43 |
40 // Fills |error_strings| with values to be used to build an error page which | 44 // Fills |error_strings| with values to be used to build an error page which |
41 // warns against reposting form data. This is special cased because the form | 45 // warns against reposting form data. This is special cased because the form |
42 // repost "error page" has no real error associated with it, and doesn't have | 46 // repost "error page" has no real error associated with it, and doesn't have |
43 // enough strings localized to meaningfully fill the net error template. | 47 // enough strings localized to meaningfully fill the net error template. |
44 static void GetFormRepostStrings(const GURL& display_url, | 48 static void GetFormRepostStrings(const GURL& display_url, |
45 base::DictionaryValue* error_strings); | 49 base::DictionaryValue* error_strings); |
46 | 50 |
47 // Fills |error_strings| with values to be used to build an error page used | 51 // Fills |error_strings| with values to be used to build an error page used |
48 // on HTTP errors, like 404 or connection reset, but using information from | 52 // on HTTP errors, like 404 or connection reset, but using information from |
49 // the associated |app| in order to make the error page look like it's more | 53 // the associated |app| in order to make the error page look like it's more |
50 // part of the app. | 54 // part of the app. |
51 static void GetAppErrorStrings(const WebKit::WebURLError& error, | 55 static void GetAppErrorStrings(const WebKit::WebURLError& error, |
52 const GURL& display_url, | 56 const GURL& display_url, |
53 const extensions::Extension* app, | 57 const extensions::Extension* app, |
54 base::DictionaryValue* error_strings); | 58 base::DictionaryValue* error_strings); |
55 | 59 |
56 static const char kHttpErrorDomain[]; | 60 static const char kHttpErrorDomain[]; |
57 | 61 |
58 private: | 62 private: |
59 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalizedError); | 63 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalizedError); |
60 }; | 64 }; |
61 | 65 |
62 #endif // CHROME_RENDERER_LOCALIZED_ERROR_H_ | 66 #endif // CHROME_COMMON_LOCALIZED_ERROR_H_ |
OLD | NEW |