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

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

Issue 2074733002: Add public API for handling Javascript alerts and prompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_DELEGATE_BRIDGE_H_ 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_
6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 #import "base/ios/weak_nsobject.h" 10 #import "base/ios/weak_nsobject.h"
11 #include "ios/web/public/web_state/web_state_delegate.h" 11 #include "ios/web/public/web_state/web_state_delegate.h"
12 12
13 // Objective-C interface for web::WebStateDelegate. 13 // Objective-C interface for web::WebStateDelegate.
14 @protocol CRWWebStateDelegate<NSObject> 14 @protocol CRWWebStateDelegate<NSObject>
15 @optional 15 @optional
16 16
17 // Called when the page has made some progress loading. |progress| is a value 17 // Called when the page has made some progress loading. |progress| is a value
18 // between 0.0 (nothing loaded) to 1.0 (page fully loaded). 18 // between 0.0 (nothing loaded) to 1.0 (page fully loaded).
19 - (void)webState:(web::WebState*)webState didChangeProgress:(double)progress; 19 - (void)webState:(web::WebState*)webState didChangeProgress:(double)progress;
20 20
21 // Called when the user triggers the context menu with the given 21 // Called when the user triggers the context menu with the given
22 // |ContextMenuParams|. Returns YES if the context menu operation was 22 // |ContextMenuParams|. Returns YES if the context menu operation was
23 // handled by the delegate. If this method is not implemented, the system 23 // handled by the delegate. If this method is not implemented, the system
24 // context menu will be displayed. 24 // context menu will be displayed.
25 - (BOOL)webState:(web::WebState*)webState 25 - (BOOL)webState:(web::WebState*)webState
26 handleContextMenu:(const web::ContextMenuParams&)params; 26 handleContextMenu:(const web::ContextMenuParams&)params;
27 27
28 // Returns a pointer to a service to manage dialogs. May return nil in which
Eugene But (OOO till 7-30) 2016/06/27 21:09:37 NIT: s/nil/null nil is a specific value for Object
michaeldo 2016/06/27 22:25:10 Done.
29 // case dialogs aren't shown.
30 - (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState:
31 (web::WebState*)webState;
32
28 @end 33 @end
29 34
30 namespace web { 35 namespace web {
31 36
32 // Adapter to use an id<CRWWebStateDelegate> as a web::WebStateDelegate. 37 // Adapter to use an id<CRWWebStateDelegate> as a web::WebStateDelegate.
33 class WebStateDelegateBridge : public web::WebStateDelegate { 38 class WebStateDelegateBridge : public web::WebStateDelegate {
34 public: 39 public:
35 explicit WebStateDelegateBridge(id<CRWWebStateDelegate> delegate); 40 explicit WebStateDelegateBridge(id<CRWWebStateDelegate> delegate);
36 ~WebStateDelegateBridge() override; 41 ~WebStateDelegateBridge() override;
37 42
38 // web::WebStateDelegate methods. 43 // web::WebStateDelegate methods.
39 void LoadProgressChanged(WebState* source, double progress) override; 44 void LoadProgressChanged(WebState* source, double progress) override;
40 bool HandleContextMenu(WebState* source, 45 bool HandleContextMenu(WebState* source,
41 const ContextMenuParams& params) override; 46 const ContextMenuParams& params) override;
47 JavaScriptDialogPresenter* GetJavaScriptDialogPresenter(
48 WebState* source) override;
42 49
43 private: 50 private:
44 // CRWWebStateDelegate which receives forwarded calls. 51 // CRWWebStateDelegate which receives forwarded calls.
45 base::WeakNSProtocol<id<CRWWebStateDelegate>> delegate_; 52 base::WeakNSProtocol<id<CRWWebStateDelegate>> delegate_;
46 DISALLOW_COPY_AND_ASSIGN(WebStateDelegateBridge); 53 DISALLOW_COPY_AND_ASSIGN(WebStateDelegateBridge);
47 }; 54 };
48 55
49 } // web 56 } // web
50 57
51 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ 58 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698