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 const std::string
& locale
,
38 const std::string
& accept_languages
,
39 scoped_ptr
<error_page::ErrorPageParams
> params
,
40 base::DictionaryValue
* strings
);
42 // Returns a description of the encountered error.
43 static base::string16
GetErrorDetails(const blink::WebURLError
& error
,
46 // Returns true if an error page exists for the specified parameters.
47 static bool HasStrings(const std::string
& error_domain
, int error_code
);
49 static const char kHttpErrorDomain
[];
52 // Sets up the Google Cached Copy button experiment if part of the
53 // field trial. This promotes the Google cached copy suggestion from under
54 // the details section to a blue button. Also experiments with the
56 static void EnableGoogleCachedCopyButtonExperiment(
57 base::ListValue
* suggestions
,
58 base::DictionaryValue
* error_strings
);
60 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalizedError
);
63 #endif // CHROME_COMMON_LOCALIZED_ERROR_H_