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

Side by Side Diff: chrome/browser/guestview/webview/webview_guest.h

Issue 21297005: <webview>: Refactor Permission API to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup_permissions
Patch Set: Fixed some bugs Created 7 years, 4 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 CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ 5 #ifndef CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_
6 #define CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ 6 #define CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_
7 7
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "chrome/browser/extensions/tab_helper.h" 9 #include "chrome/browser/extensions/tab_helper.h"
10 #include "chrome/browser/guestview/guestview.h" 10 #include "chrome/browser/guestview/guestview.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 virtual void AddMessageToConsole(int32 level, 43 virtual void AddMessageToConsole(int32 level,
44 const string16& message, 44 const string16& message,
45 int32 line_no, 45 int32 line_no,
46 const string16& source_id) OVERRIDE; 46 const string16& source_id) OVERRIDE;
47 virtual void Close() OVERRIDE; 47 virtual void Close() OVERRIDE;
48 virtual void GuestProcessGone(base::TerminationStatus status) OVERRIDE; 48 virtual void GuestProcessGone(base::TerminationStatus status) OVERRIDE;
49 virtual bool HandleKeyboardEvent( 49 virtual bool HandleKeyboardEvent(
50 const content::NativeWebKeyboardEvent& event) OVERRIDE; 50 const content::NativeWebKeyboardEvent& event) OVERRIDE;
51 virtual void RendererResponsive() OVERRIDE; 51 virtual void RendererResponsive() OVERRIDE;
52 virtual void RendererUnresponsive() OVERRIDE; 52 virtual void RendererUnresponsive() OVERRIDE;
53 virtual bool RequestPermission(
54 BrowserPluginPermissionType permission_type,
55 const base::DictionaryValue& request_info,
56 const PermissionResponseCallback& callback) OVERRIDE;
53 57
54 // NotificationObserver implementation. 58 // NotificationObserver implementation.
55 virtual void Observe(int type, 59 virtual void Observe(int type,
56 const content::NotificationSource& source, 60 const content::NotificationSource& source,
57 const content::NotificationDetails& details) OVERRIDE; 61 const content::NotificationDetails& details) OVERRIDE;
58 62
59 // If possible, navigate the guest to |relative_index| entries away from the 63 // If possible, navigate the guest to |relative_index| entries away from the
60 // current navigation entry. 64 // current navigation entry.
61 void Go(int relative_index); 65 void Go(int relative_index);
62 66
63 // Reload the guest. 67 // Reload the guest.
64 void Reload(); 68 void Reload();
65 69
70 // Responds to the permission request |request_id| with |should_allow| and
71 // |user_input|.
lazyboy 2013/08/05 09:26:58 Also say what the return value is
Fady Samuel 2013/08/06 07:14:40 Done.
72 bool SetPermission(int request_id,
73 bool should_allow,
74 const std::string& user_input);
75
66 // Stop loading the guest. 76 // Stop loading the guest.
67 void Stop(); 77 void Stop();
68 78
69 // Kill the guest process. 79 // Kill the guest process.
70 void Terminate(); 80 void Terminate();
71 81
72 extensions::ScriptExecutor* script_executor() { 82 extensions::ScriptExecutor* script_executor() {
73 return script_executor_.get(); 83 return script_executor_.get();
74 } 84 }
75 85
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void AddWebViewToExtensionRendererState(); 124 void AddWebViewToExtensionRendererState();
115 static void RemoveWebViewFromExtensionRendererState( 125 static void RemoveWebViewFromExtensionRendererState(
116 content::WebContents* web_contents); 126 content::WebContents* web_contents);
117 127
118 ObserverList<extensions::TabHelper::ScriptExecutionObserver> 128 ObserverList<extensions::TabHelper::ScriptExecutionObserver>
119 script_observers_; 129 script_observers_;
120 scoped_ptr<extensions::ScriptExecutor> script_executor_; 130 scoped_ptr<extensions::ScriptExecutor> script_executor_;
121 131
122 content::NotificationRegistrar notification_registrar_; 132 content::NotificationRegistrar notification_registrar_;
123 133
134 // A counter to generate a unique request id for a permission request.
135 // We only need the ids to be unique for a given WebViewGuest.
136 int next_permission_request_id_;
137
138 // A map to store the callback for a request keyed by the request's id.
139 typedef std::map<int, PermissionResponseCallback> RequestMap;
140 RequestMap pending_permission_requests_;
141
124 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); 142 DISALLOW_COPY_AND_ASSIGN(WebViewGuest);
125 }; 143 };
126 144
127 #endif // CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ 145 #endif // CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698