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

Unified Diff: ios/web/public/web_state/web_state.h

Issue 1022463002: [iOS] Upstream files in //ios/chrome/browser/autofill (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/public/web_state/crw_web_view_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/web_state/web_state.h
diff --git a/ios/web/public/web_state/web_state.h b/ios/web/public/web_state/web_state.h
index 9c0418ba5dd5e6f073b7a89beed251038e20c17b..166e52ba5577907e4c163f0e66ef24afe57c963b 100644
--- a/ios/web/public/web_state/web_state.h
+++ b/ios/web/public/web_state/web_state.h
@@ -6,21 +6,30 @@
#define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_H_
#include <string>
+#include <vector>
#include "base/callback_forward.h"
#include "base/supports_user_data.h"
#include "ios/web/public/referrer.h"
+#include "ios/web/public/web_state/url_verification_constants.h"
+#include "ios/web/public/web_view_type.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/window_open_disposition.h"
+#include "ui/gfx/geometry/size.h"
#include "url/gurl.h"
class GURL;
+class SkBitmap;
#if defined(__OBJC__)
-// TODO(droger): Convert all the public web API to C++.
@class CRWJSInjectionReceiver;
+@protocol CRWWebViewProxy;
+typedef id<CRWWebViewProxy> CRWWebViewProxyType;
+@class UIView;
#else
class CRWJSInjectionReceiver;
+typedef void* CRWWebViewProxyType;
+class UIView;
#endif // defined(__OBJC__)
namespace base {
@@ -31,6 +40,7 @@ namespace web {
class BrowserState;
class NavigationManager;
+class WebInterstitial;
class WebStateObserver;
// Core interface for interaction with the web.
@@ -59,8 +69,29 @@ class WebState : public base::SupportsUserData {
bool is_renderer_initiated;
};
+ // Callback for |DownloadImage()|.
+ typedef base::Callback<void(
+ int, /* id */
+ int, /* HTTP status code */
+ const GURL&, /* image_url */
+ const std::vector<SkBitmap>&, /* bitmaps */
+ /* The sizes in pixel of the bitmaps before they were resized due to the
+ max bitmap size passed to DownloadImage(). Each entry in the bitmaps
+ vector corresponds to an entry in the sizes vector. If a bitmap was
+ resized, there should be a single returned bitmap. */
+ const std::vector<gfx::Size>&)>
+ ImageDownloadCallback;
+
~WebState() override {}
+ // The view containing the contents of the current web page. If the view has
+ // been purged due to low memory, this will recreate it. It is up to the
+ // caller to size the view.
+ virtual UIView* GetView() = 0;
+
+ // Returns the type of the web view associated with this WebState.
+ virtual WebViewType GetWebViewType() const = 0;
+
// Gets the BrowserState associated with this WebState. Can never return null.
virtual BrowserState* GetBrowserState() const = 0;
@@ -95,6 +126,20 @@ class WebState : public base::SupportsUserData {
// displayed in this WebState. It represents the current security context.
virtual const GURL& GetLastCommittedURL() const = 0;
+ // Returns the WebState view of the current URL. Moreover, this method
+ // will set the trustLevel enum to the appropriate level from a security point
+ // of view. The caller has to handle the case where |trust_level| is not
+ // appropriate.
+ // TODO(stuartmorgan): Figure out a clean API for this.
+ // See http://crbug.com/457679
+ virtual GURL GetCurrentURL(URLVerificationTrustLevel* trust_level) const = 0;
+
+ // Returns true if a WebInterstitial is currently displayed.
+ virtual bool IsShowingWebInterstitial() const = 0;
+
+ // Returns the currently visible WebInterstitial if one is shown.
+ virtual WebInterstitial* GetWebInterstitial() const = 0;
+
// Callback used to handle script commands.
// The callback must return true if the command was handled, and false
// otherwise.
@@ -115,6 +160,9 @@ class WebState : public base::SupportsUserData {
virtual void RemoveScriptCommandCallback(
const std::string& command_prefix) = 0;
+ // Returns the current CRWWebViewProxy object.
+ virtual CRWWebViewProxyType GetWebViewProxy() const = 0;
+
protected:
friend class WebStateObserver;
« no previous file with comments | « ios/web/public/web_state/crw_web_view_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698