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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_permission_helper.h

Issue 2512563003: Convert enable_plugins to a buildflag header. (Closed)
Patch Set: Merge Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/metrics/user_metrics_action.h" 10 #include "base/metrics/user_metrics_action.h"
11 #include "components/guest_view/common/guest_view_constants.h" 11 #include "components/guest_view/common/guest_view_constants.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "content/public/browser/web_contents_observer.h" 13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/common/media_stream_request.h" 14 #include "content/public/common/media_stream_request.h"
15 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" 15 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h"
16 #include "ppapi/features/features.h"
16 17
17 using base::UserMetricsAction; 18 using base::UserMetricsAction;
18 19
19 namespace extensions { 20 namespace extensions {
20 21
21 class WebViewGuest; 22 class WebViewGuest;
22 class WebViewPermissionHelperDelegate; 23 class WebViewPermissionHelperDelegate;
23 24
24 // WebViewPermissionHelper manages <webview> permission requests. This helper 25 // WebViewPermissionHelper manages <webview> permission requests. This helper
25 // class is owned by WebViewGuest. Its purpose is to request permission for 26 // class is owned by WebViewGuest. Its purpose is to request permission for
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void CancelPendingPermissionRequest(int request_id); 135 void CancelPendingPermissionRequest(int request_id);
135 136
136 WebViewGuest* web_view_guest() { return web_view_guest_; } 137 WebViewGuest* web_view_guest() { return web_view_guest_; }
137 138
138 private: 139 private:
139 void OnMediaPermissionResponse(const content::MediaStreamRequest& request, 140 void OnMediaPermissionResponse(const content::MediaStreamRequest& request,
140 const content::MediaResponseCallback& callback, 141 const content::MediaResponseCallback& callback,
141 bool allow, 142 bool allow,
142 const std::string& user_input); 143 const std::string& user_input);
143 144
144 #if defined(ENABLE_PLUGINS) 145 #if BUILDFLAG(ENABLE_PLUGINS)
145 // content::WebContentsObserver implementation. 146 // content::WebContentsObserver implementation.
146 bool OnMessageReceived(const IPC::Message& message, 147 bool OnMessageReceived(const IPC::Message& message,
147 content::RenderFrameHost* render_frame_host) override; 148 content::RenderFrameHost* render_frame_host) override;
148 bool OnMessageReceived(const IPC::Message& message) override; 149 bool OnMessageReceived(const IPC::Message& message) override;
149 #endif // defined(ENABLE_PLUGINS) 150 #endif // BUILDFLAG(ENABLE_PLUGINS)
150 151
151 // A counter to generate a unique request id for a permission request. 152 // A counter to generate a unique request id for a permission request.
152 // We only need the ids to be unique for a given WebViewGuest. 153 // We only need the ids to be unique for a given WebViewGuest.
153 int next_permission_request_id_; 154 int next_permission_request_id_;
154 155
155 WebViewPermissionHelper::RequestMap pending_permission_requests_; 156 WebViewPermissionHelper::RequestMap pending_permission_requests_;
156 157
157 std::unique_ptr<WebViewPermissionHelperDelegate> 158 std::unique_ptr<WebViewPermissionHelperDelegate>
158 web_view_permission_helper_delegate_; 159 web_view_permission_helper_delegate_;
159 160
160 WebViewGuest* const web_view_guest_; 161 WebViewGuest* const web_view_guest_;
161 162
162 base::WeakPtrFactory<WebViewPermissionHelper> weak_factory_; 163 base::WeakPtrFactory<WebViewPermissionHelper> weak_factory_;
163 164
164 DISALLOW_COPY_AND_ASSIGN(WebViewPermissionHelper); 165 DISALLOW_COPY_AND_ASSIGN(WebViewPermissionHelper);
165 }; 166 };
166 167
167 } // namespace extensions 168 } // namespace extensions
168 169
169 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ 170 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/web_view/BUILD.gn ('k') | extensions/browser/guest_view/web_view/web_view_permission_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698