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_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h"
16 class DictionaryValue
;
24 namespace error_page
{
25 struct ErrorPageParams
;
28 class LocalizedError
{
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
,
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
,
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
[];
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
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_