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

Side by Side Diff: chrome/browser/extensions/api/tab_capture/offscreen_tab.cc

Issue 2775553002: Adds the ability for WebContentsDelegate to decide if event should be updated (Closed)
Patch Set: Fix compile Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "chrome/browser/extensions/api/tab_capture/offscreen_tab.h" 5 #include "chrome/browser/extensions/api/tab_capture/offscreen_tab.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" 12 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/web_contents_sizer.h" 14 #include "chrome/browser/ui/web_contents_sizer.h"
15 #include "content/public/browser/keyboard_event_processing_result.h"
15 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/render_widget_host_view.h" 17 #include "content/public/browser/render_widget_host_view.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/web_preferences.h" 19 #include "content/public/common/web_preferences.h"
19 #include "extensions/browser/extension_host.h" 20 #include "extensions/browser/extension_host.h"
20 #include "extensions/browser/process_manager.h" 21 #include "extensions/browser/process_manager.h"
21 22
22 #if defined(ENABLE_MEDIA_ROUTER) 23 #if defined(ENABLE_MEDIA_ROUTER)
23 #include "chrome/browser/media/router/receiver_presentation_service_delegate_imp l.h" // nogncheck 24 #include "chrome/browser/media/router/receiver_presentation_service_delegate_imp l.h" // nogncheck
24 #endif 25 #endif
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 callback.Run(false); 188 callback.Run(false);
188 } 189 }
189 190
190 bool OffscreenTab::HandleContextMenu(const content::ContextMenuParams& params) { 191 bool OffscreenTab::HandleContextMenu(const content::ContextMenuParams& params) {
191 // Context menus should never be shown. Do nothing, but indicate the context 192 // Context menus should never be shown. Do nothing, but indicate the context
192 // menu was shown so that default implementation in libcontent does not 193 // menu was shown so that default implementation in libcontent does not
193 // attempt to do so on its own. 194 // attempt to do so on its own.
194 return true; 195 return true;
195 } 196 }
196 197
197 bool OffscreenTab::PreHandleKeyboardEvent( 198 content::KeyboardEventProcessingResult OffscreenTab::PreHandleKeyboardEvent(
198 WebContents* source, 199 WebContents* source,
199 const content::NativeWebKeyboardEvent& event, 200 const content::NativeWebKeyboardEvent& event) {
200 bool* is_keyboard_shortcut) {
201 DCHECK_EQ(offscreen_tab_web_contents_.get(), source); 201 DCHECK_EQ(offscreen_tab_web_contents_.get(), source);
202 // Intercept and silence all keyboard events before they can be sent to the 202 // Intercept and silence all keyboard events before they can be sent to the
203 // renderer. 203 // renderer.
204 *is_keyboard_shortcut = false; 204 return content::KeyboardEventProcessingResult::HANDLED;
205 return true;
206 } 205 }
207 206
208 bool OffscreenTab::PreHandleGestureEvent(WebContents* source, 207 bool OffscreenTab::PreHandleGestureEvent(WebContents* source,
209 const blink::WebGestureEvent& event) { 208 const blink::WebGestureEvent& event) {
210 DCHECK_EQ(offscreen_tab_web_contents_.get(), source); 209 DCHECK_EQ(offscreen_tab_web_contents_.get(), source);
211 // Intercept and silence all gesture events before they can be sent to the 210 // Intercept and silence all gesture events before they can be sent to the
212 // renderer. 211 // renderer.
213 return true; 212 return true;
214 } 213 }
215 214
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 381
383 // Schedule the timer to check again in a second. 382 // Schedule the timer to check again in a second.
384 capture_poll_timer_.Start( 383 capture_poll_timer_.Start(
385 FROM_HERE, 384 FROM_HERE,
386 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), 385 base::TimeDelta::FromSeconds(kPollIntervalInSeconds),
387 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, 386 base::Bind(&OffscreenTab::DieIfContentCaptureEnded,
388 base::Unretained(this))); 387 base::Unretained(this)));
389 } 388 }
390 389
391 } // namespace extensions 390 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tab_capture/offscreen_tab.h ('k') | chrome/browser/extensions/extension_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698