Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_RENDERER_LOCALIZED_ERROR_H_ | 5 #ifndef CHROME_RENDERER_LOCALIZED_ERROR_H_ |
| 6 #define CHROME_RENDERER_LOCALIZED_ERROR_H_ | 6 #define CHROME_RENDERER_LOCALIZED_ERROR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/ref_counted.h" | |
| 12 | 13 |
| 13 class DictionaryValue; | 14 class DictionaryValue; |
| 14 class ExtensionRendererInfo; | 15 class Extension; |
| 15 class GURL; | 16 class GURL; |
| 16 | 17 |
| 17 namespace WebKit { | 18 namespace WebKit { |
| 18 struct WebURLError; | 19 struct WebURLError; |
| 19 } | 20 } |
| 20 | 21 |
| 21 class LocalizedError { | 22 class LocalizedError { |
| 22 public: | 23 public: |
| 23 // Fills |error_strings| with values to be used to build an error page used | 24 // Fills |error_strings| with values to be used to build an error page used |
| 24 // on HTTP errors, like 404 or connection reset. | 25 // on HTTP errors, like 404 or connection reset. |
| 25 static void GetStrings(const WebKit::WebURLError& error, | 26 static void GetStrings(const WebKit::WebURLError& error, |
| 26 DictionaryValue* strings); | 27 DictionaryValue* strings); |
| 27 | 28 |
| 28 // Returns true if an error page exists for the specified parameters. | 29 // Returns true if an error page exists for the specified parameters. |
| 29 static bool HasStrings(const std::string& error_domain, int error_code); | 30 static bool HasStrings(const std::string& error_domain, int error_code); |
| 30 | 31 |
| 31 // Fills |error_strings| with values to be used to build an error page which | 32 // Fills |error_strings| with values to be used to build an error page which |
| 32 // warns against reposting form data. This is special cased because the form | 33 // warns against reposting form data. This is special cased because the form |
| 33 // repost "error page" has no real error associated with it, and doesn't have | 34 // repost "error page" has no real error associated with it, and doesn't have |
| 34 // enough strings localized to meaningfully fill the net error template. | 35 // enough strings localized to meaningfully fill the net error template. |
| 35 static void GetFormRepostStrings(const GURL& display_url, | 36 static void GetFormRepostStrings(const GURL& display_url, |
| 36 DictionaryValue* error_strings); | 37 DictionaryValue* error_strings); |
| 37 | 38 |
| 38 // Fills |error_strings| with values to be used to build an error page used | 39 // Fills |error_strings| with values to be used to build an error page used |
| 39 // on HTTP errors, like 404 or connection reset, but using information from | 40 // on HTTP errors, like 404 or connection reset, but using information from |
| 40 // the associated |app| in order to make the error page look like it's more | 41 // the associated |app| in order to make the error page look like it's more |
| 41 // part of the app. | 42 // part of the app. |
| 42 static void GetAppErrorStrings(const WebKit::WebURLError& error, | 43 static void GetAppErrorStrings(const WebKit::WebURLError& error, |
| 43 const GURL& display_url, | 44 const GURL& display_url, |
| 44 const ExtensionRendererInfo* app, | 45 const scoped_refptr<const Extension>& app, |
|
Matt Perry
2011/01/24 20:08:34
raw pointer here too?
Aaron Boodman
2011/01/25 00:27:33
Done.
| |
| 45 DictionaryValue* error_strings); | 46 DictionaryValue* error_strings); |
| 46 | 47 |
| 47 static const char kHttpErrorDomain[]; | 48 static const char kHttpErrorDomain[]; |
| 48 | 49 |
| 49 private: | 50 private: |
| 50 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalizedError); | 51 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalizedError); |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 #endif // CHROME_RENDERER_LOCALIZED_ERROR_H_ | 54 #endif // CHROME_RENDERER_LOCALIZED_ERROR_H_ |
| OLD | NEW |