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