Add ICU message format support
[chromium-blink-merge.git] / chrome / common / localized_error.h
blob395668ca62736e877a0c58ede534ea0f18cf6e1b
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
3 // found in the LICENSE file.
5 #ifndef CHROME_COMMON_LOCALIZED_ERROR_H_
6 #define CHROME_COMMON_LOCALIZED_ERROR_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h"
13 #include "url/gurl.h"
15 namespace base {
16 class DictionaryValue;
17 class ListValue;
20 namespace blink {
21 struct WebURLError;
24 namespace error_page {
25 struct ErrorPageParams;
28 class LocalizedError {
29 public:
30 // Fills |error_strings| with values to be used to build an error page used
31 // on HTTP errors, like 404 or connection reset.
32 static void GetStrings(int error_code,
33 const std::string& error_domain,
34 const GURL& failed_url,
35 bool is_post,
36 bool stale_copy_in_cache,
37 bool can_show_network_diagnostics_dialog,
38 const std::string& locale,
39 const std::string& accept_languages,
40 scoped_ptr<error_page::ErrorPageParams> params,
41 base::DictionaryValue* strings);
43 // Returns a description of the encountered error.
44 static base::string16 GetErrorDetails(const blink::WebURLError& error,
45 bool is_post);
47 // Returns true if an error page exists for the specified parameters.
48 static bool HasStrings(const std::string& error_domain, int error_code);
50 static const char kHttpErrorDomain[];
52 private:
53 // Sets up the Google Cached Copy button experiment if part of the
54 // field trial. This promotes the Google cached copy suggestion from under
55 // the details section to a blue button. Also experiments with the
56 // button label.
57 static void EnableGoogleCachedCopyButtonExperiment(
58 base::ListValue* suggestions,
59 base::DictionaryValue* error_strings);
61 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalizedError);
64 #endif // CHROME_COMMON_LOCALIZED_ERROR_H_