| 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 WEBKIT_GLUE_WEBKIT_GLUE_H_ | 5 #ifndef WEBKIT_GLUE_WEBKIT_GLUE_H_ |
| 6 #define WEBKIT_GLUE_WEBKIT_GLUE_H_ | 6 #define WEBKIT_GLUE_WEBKIT_GLUE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 float page_height_in_pixels); | 81 float page_height_in_pixels); |
| 82 | 82 |
| 83 // Returns a dump of the scroll position of the webframe. | 83 // Returns a dump of the scroll position of the webframe. |
| 84 string16 DumpFrameScrollPosition(WebKit::WebFrame* web_frame, bool recursive); | 84 string16 DumpFrameScrollPosition(WebKit::WebFrame* web_frame, bool recursive); |
| 85 | 85 |
| 86 // Returns a dump of the given history state suitable for implementing the | 86 // Returns a dump of the given history state suitable for implementing the |
| 87 // dumpBackForwardList command of the layoutTestController. | 87 // dumpBackForwardList command of the layoutTestController. |
| 88 string16 DumpHistoryState(const std::string& history_state, int indent, | 88 string16 DumpHistoryState(const std::string& history_state, int indent, |
| 89 bool is_current); | 89 bool is_current); |
| 90 | 90 |
| 91 // Called to override the default user agent with a custom one. Call this | 91 // Sets the user agent. Pass true for overriding if this is a custom |
| 92 // before anyone actually asks for the user agent in order to prevent | 92 // user agent instead of the default one (in order to turn off any browser |
| 93 // inconsistent behavior. | 93 // sniffing workarounds). This must be called before GetUserAgent() can |
| 94 void SetUserAgent(const std::string& new_user_agent); | 94 // be called. |
| 95 void SetUserAgent(const std::string& user_agent, bool overriding); |
| 95 | 96 |
| 96 // Returns the user agent to use for the given URL, which is usually the | 97 // Returns the user agent to use for the given URL. SetUserAgent() must |
| 97 // default user agent but may be overriden by a call to SetUserAgent() (which | 98 // be called prior to calling this function. |
| 98 // should be done at startup). | |
| 99 const std::string& GetUserAgent(const GURL& url); | 99 const std::string& GetUserAgent(const GURL& url); |
| 100 | 100 |
| 101 // Creates serialized state for the specified URL. This is a variant of | 101 // Creates serialized state for the specified URL. This is a variant of |
| 102 // HistoryItemToString (in glue_serialize) that is used during session restore | 102 // HistoryItemToString (in glue_serialize) that is used during session restore |
| 103 // if the saved state is empty. | 103 // if the saved state is empty. |
| 104 std::string CreateHistoryStateForURL(const GURL& url); | 104 std::string CreateHistoryStateForURL(const GURL& url); |
| 105 | 105 |
| 106 // Removes any form data state from the history state string |content_state|. | 106 // Removes any form data state from the history state string |content_state|. |
| 107 std::string RemoveFormDataFromHistoryState(const std::string& content_state); | 107 std::string RemoveFormDataFromHistoryState(const std::string& content_state); |
| 108 | 108 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 base::PlatformFileError error_code); | 140 base::PlatformFileError error_code); |
| 141 | 141 |
| 142 // Returns a WebCanvas pointer associated with the given Skia canvas. | 142 // Returns a WebCanvas pointer associated with the given Skia canvas. |
| 143 WebKit::WebCanvas* ToWebCanvas(skia::PlatformCanvas*); | 143 WebKit::WebCanvas* ToWebCanvas(skia::PlatformCanvas*); |
| 144 | 144 |
| 145 // Returns the number of currently-active glyph pages this process is using. | 145 // Returns the number of currently-active glyph pages this process is using. |
| 146 // There can be many such pages (maps of 256 character -> glyph) so this is | 146 // There can be many such pages (maps of 256 character -> glyph) so this is |
| 147 // used to get memory usage statistics. | 147 // used to get memory usage statistics. |
| 148 int GetGlyphPageCount(); | 148 int GetGlyphPageCount(); |
| 149 | 149 |
| 150 // Construct the User-Agent header, filling in |result|. | |
| 151 // - If mimic_windows is true, produce a fake Windows Chrome string. | |
| 152 std::string BuildUserAgent(bool mimic_windows); | |
| 153 | |
| 154 //---- END FUNCTIONS IMPLEMENTED BY WEBKIT/GLUE ------------------------------- | 150 //---- END FUNCTIONS IMPLEMENTED BY WEBKIT/GLUE ------------------------------- |
| 155 | 151 |
| 156 | 152 |
| 157 //---- BEGIN FUNCTIONS IMPLEMENTED BY EMBEDDER -------------------------------- | 153 //---- BEGIN FUNCTIONS IMPLEMENTED BY EMBEDDER -------------------------------- |
| 158 | 154 |
| 159 // Glue to get resources from the embedder. | 155 // Glue to get resources from the embedder. |
| 160 | 156 |
| 161 // Gets a localized string given a message id. Returns an empty string if the | 157 // Gets a localized string given a message id. Returns an empty string if the |
| 162 // message id is not found. | 158 // message id is not found. |
| 163 string16 GetLocalizedString(int message_id); | 159 string16 GetLocalizedString(int message_id); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 bool GetFontTable(int fd, uint32_t table, uint8_t* output, | 233 bool GetFontTable(int fd, uint32_t table, uint8_t* output, |
| 238 size_t* output_length); | 234 size_t* output_length); |
| 239 #endif | 235 #endif |
| 240 | 236 |
| 241 // ---- END FUNCTIONS IMPLEMENTED BY EMBEDDER --------------------------------- | 237 // ---- END FUNCTIONS IMPLEMENTED BY EMBEDDER --------------------------------- |
| 242 | 238 |
| 243 | 239 |
| 244 } // namespace webkit_glue | 240 } // namespace webkit_glue |
| 245 | 241 |
| 246 #endif // WEBKIT_GLUE_WEBKIT_GLUE_H_ | 242 #endif // WEBKIT_GLUE_WEBKIT_GLUE_H_ |
| OLD | NEW |