Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1096)

Side by Side Diff: ios/web/public/web_state/web_state.h

Issue 2677993002: Use IOSImageDataFetcherWrapper for favicon (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_
6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/supports_user_data.h" 15 #include "base/supports_user_data.h"
16 #include "ios/web/public/referrer.h" 16 #include "ios/web/public/referrer.h"
17 #include "ios/web/public/web_state/url_verification_constants.h" 17 #include "ios/web/public/web_state/url_verification_constants.h"
18 #include "ui/base/page_transition_types.h" 18 #include "ui/base/page_transition_types.h"
19 #include "ui/base/window_open_disposition.h" 19 #include "ui/base/window_open_disposition.h"
20 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
21 #include "url/gurl.h" 21 #include "url/gurl.h"
22 22
23 class GURL; 23 class GURL;
24 class SkBitmap;
25 24
26 @class CRWJSInjectionReceiver; 25 @class CRWJSInjectionReceiver;
27 @class CRWNavigationManagerStorage; 26 @class CRWNavigationManagerStorage;
28 @protocol CRWScrollableContent; 27 @protocol CRWScrollableContent;
29 @protocol CRWWebViewProxy; 28 @protocol CRWWebViewProxy;
30 typedef id<CRWWebViewProxy> CRWWebViewProxyType; 29 typedef id<CRWWebViewProxy> CRWWebViewProxyType;
31 @class UIView; 30 @class UIView;
32 typedef UIView<CRWScrollableContent> CRWContentView; 31 typedef UIView<CRWScrollableContent> CRWContentView;
33 32
34 namespace base { 33 namespace base {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // The disposition requested by the navigation source. 76 // The disposition requested by the navigation source.
78 WindowOpenDisposition disposition; 77 WindowOpenDisposition disposition;
79 78
80 // The transition type of navigation. 79 // The transition type of navigation.
81 ui::PageTransition transition; 80 ui::PageTransition transition;
82 81
83 // Whether this navigation is initiated by the renderer process. 82 // Whether this navigation is initiated by the renderer process.
84 bool is_renderer_initiated; 83 bool is_renderer_initiated;
85 }; 84 };
86 85
87 // Callback for |DownloadImage()|.
88 typedef base::Callback<void(
89 int, /* id */
90 int, /* HTTP status code */
91 const GURL&, /* image_url */
92 const std::vector<SkBitmap>&, /* bitmaps */
93 /* The sizes in pixel of the bitmaps before they were resized due to the
94 max bitmap size passed to DownloadImage(). Each entry in the bitmaps
95 vector corresponds to an entry in the sizes vector. If a bitmap was
96 resized, there should be a single returned bitmap. */
97 const std::vector<gfx::Size>&)>
98 ImageDownloadCallback;
99
100 // Creates a new WebState. 86 // Creates a new WebState.
101 static std::unique_ptr<WebState> Create(const CreateParams& params); 87 static std::unique_ptr<WebState> Create(const CreateParams& params);
102 // Creates a new WebState from a serialized NavigationManager. 88 // Creates a new WebState from a serialized NavigationManager.
103 static std::unique_ptr<WebState> Create( 89 static std::unique_ptr<WebState> Create(
104 const CreateParams& params, 90 const CreateParams& params,
105 CRWNavigationManagerStorage* session_storage); 91 CRWNavigationManagerStorage* session_storage);
106 92
107 ~WebState() override {} 93 ~WebState() override {}
108 94
109 // Gets/Sets the delegate. 95 // Gets/Sets the delegate.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 virtual void AddScriptCommandCallback(const ScriptCommandCallback& callback, 221 virtual void AddScriptCommandCallback(const ScriptCommandCallback& callback,
236 const std::string& command_prefix) = 0; 222 const std::string& command_prefix) = 0;
237 223
238 // Removes the callback associated with |command_prefix|. 224 // Removes the callback associated with |command_prefix|.
239 virtual void RemoveScriptCommandCallback( 225 virtual void RemoveScriptCommandCallback(
240 const std::string& command_prefix) = 0; 226 const std::string& command_prefix) = 0;
241 227
242 // Returns the current CRWWebViewProxy object. 228 // Returns the current CRWWebViewProxy object.
243 virtual CRWWebViewProxyType GetWebViewProxy() const = 0; 229 virtual CRWWebViewProxyType GetWebViewProxy() const = 0;
244 230
245 // Sends a request to download the given image |url| and returns the unique
246 // id of the download request. When the download is finished, |callback| will
247 // be called with the bitmaps received from the renderer.
248 // If |is_favicon| is true, the cookies are not sent and not accepted during
249 // download.
250 // Bitmaps with pixel sizes larger than |max_bitmap_size| are filtered out
251 // from the bitmap results. If there are no bitmap results <=
252 // |max_bitmap_size|, the smallest bitmap is resized to |max_bitmap_size| and
253 // is the only result. A |max_bitmap_size| of 0 means unlimited.
254 // If |bypass_cache| is true, |url| is requested from the server even if it
255 // is present in the browser cache.
256 virtual int DownloadImage(const GURL& url,
257 bool is_favicon,
258 uint32_t max_bitmap_size,
259 bool bypass_cache,
260 const ImageDownloadCallback& callback) = 0;
261
262 // Returns Mojo interface registry for this WebState. 231 // Returns Mojo interface registry for this WebState.
263 virtual service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() = 0; 232 virtual service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() = 0;
264 233
265 protected: 234 protected:
266 friend class WebStateObserver; 235 friend class WebStateObserver;
267 friend class WebStatePolicyDecider; 236 friend class WebStatePolicyDecider;
268 237
269 // Adds and removes observers for page navigation notifications. The order in 238 // Adds and removes observers for page navigation notifications. The order in
270 // which notifications are sent to observers is undefined. Clients must be 239 // which notifications are sent to observers is undefined. Clients must be
271 // sure to remove the observer before they go away. 240 // sure to remove the observer before they go away.
(...skipping 15 matching lines...) Expand all
287 256
288 // Returns a WeakPtr<WebState> to the current WebState. Must remain private 257 // Returns a WeakPtr<WebState> to the current WebState. Must remain private
289 // and only call must be in WebStateWeakPtrFactory. Please consult that class 258 // and only call must be in WebStateWeakPtrFactory. Please consult that class
290 // for more details. Remove as part of http://crbug.com/556736. 259 // for more details. Remove as part of http://crbug.com/556736.
291 virtual base::WeakPtr<WebState> AsWeakPtr() = 0; 260 virtual base::WeakPtr<WebState> AsWeakPtr() = 0;
292 }; 261 };
293 262
294 } // namespace web 263 } // namespace web
295 264
296 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_ 265 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698