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 COMPONENTS_ERROR_PAGE_COMMON_LOCALIZED_ERROR_H_ | 5 #ifndef COMPONENTS_ERROR_PAGE_COMMON_LOCALIZED_ERROR_H_ |
6 #define COMPONENTS_ERROR_PAGE_COMMON_LOCALIZED_ERROR_H_ | 6 #define COMPONENTS_ERROR_PAGE_COMMON_LOCALIZED_ERROR_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class DictionaryValue; | 16 class DictionaryValue; |
17 } | 17 } |
18 | 18 |
19 namespace error_page { | 19 namespace error_page { |
20 | 20 |
21 struct ErrorPageParams; | 21 struct ErrorPageParams; |
22 | 22 |
23 class LocalizedError { | 23 class LocalizedError { |
24 public: | 24 public: |
25 // Fills |error_strings| with values to be used to build an error page used | 25 // Fills |error_strings| with values to be used to build an error page used |
26 // on HTTP errors, like 404 or connection reset. | 26 // on HTTP errors, like 404 or connection reset. |
27 static void GetStrings(int error_code, | 27 static void GetStrings(int error_code, |
28 const std::string& error_domain, | 28 const std::string& error_domain, |
29 const GURL& failed_url, | 29 const GURL& failed_url, |
30 bool is_post, | 30 bool is_post, |
31 bool stale_copy_in_cache, | 31 bool stale_copy_in_cache, |
32 bool can_show_network_diagnostics_dialog, | 32 bool can_show_network_diagnostics_dialog, |
33 bool has_offline_pages, | 33 bool has_offline_pages, |
34 const std::string& locale, | 34 const std::string& locale, |
35 scoped_ptr<error_page::ErrorPageParams> params, | 35 std::unique_ptr<error_page::ErrorPageParams> params, |
36 base::DictionaryValue* strings); | 36 base::DictionaryValue* strings); |
37 | 37 |
38 // Returns a description of the encountered error. | 38 // Returns a description of the encountered error. |
39 static base::string16 GetErrorDetails(const std::string& error_domain, | 39 static base::string16 GetErrorDetails(const std::string& error_domain, |
40 int error_code, | 40 int error_code, |
41 bool is_post); | 41 bool is_post); |
42 | 42 |
43 // Returns true if an error page exists for the specified parameters. | 43 // Returns true if an error page exists for the specified parameters. |
44 static bool HasStrings(const std::string& error_domain, int error_code); | 44 static bool HasStrings(const std::string& error_domain, int error_code); |
45 | 45 |
46 static const char kHttpErrorDomain[]; | 46 static const char kHttpErrorDomain[]; |
47 | 47 |
48 private: | 48 private: |
49 | 49 |
50 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalizedError); | 50 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalizedError); |
51 }; | 51 }; |
52 | 52 |
53 } // namespace error_page | 53 } // namespace error_page |
54 | 54 |
55 #endif // COMPONENTS_ERROR_PAGE_COMMON_LOCALIZED_ERROR_H_ | 55 #endif // COMPONENTS_ERROR_PAGE_COMMON_LOCALIZED_ERROR_H_ |
OLD | NEW |