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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2805763004: [System-Keyboard-Lock] Forward navigator functions to RenderFrameHost (Closed)
Patch Set: Resolve review comments Created 3 years, 8 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 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <iostream>
whywhat 2017/04/11 14:52:33 nit: don't think this is used out of curiosity, di
Hzj_jie 2017/04/12 02:51:05 Sorry, it's for debugging purpose, and I forgot to
8
7 #include <map> 9 #include <map>
8 #include <string> 10 #include <string>
9 #include <utility> 11 #include <utility>
10 #include <vector> 12 #include <vector>
11 13
12 #include "base/auto_reset.h" 14 #include "base/auto_reset.h"
13 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
16 #include "base/callback_forward.h"
14 #include "base/command_line.h" 17 #include "base/command_line.h"
15 #include "base/debug/alias.h" 18 #include "base/debug/alias.h"
16 #include "base/debug/asan_invalid_access.h" 19 #include "base/debug/asan_invalid_access.h"
17 #include "base/debug/crash_logging.h" 20 #include "base/debug/crash_logging.h"
18 #include "base/debug/dump_without_crashing.h" 21 #include "base/debug/dump_without_crashing.h"
19 #include "base/files/file.h" 22 #include "base/files/file.h"
20 #include "base/i18n/char_iterator.h" 23 #include "base/i18n/char_iterator.h"
21 #include "base/logging.h" 24 #include "base/logging.h"
22 #include "base/macros.h" 25 #include "base/macros.h"
23 #include "base/memory/ptr_util.h" 26 #include "base/memory/ptr_util.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 using blink::WebElement; 303 using blink::WebElement;
301 using blink::WebExternalPopupMenu; 304 using blink::WebExternalPopupMenu;
302 using blink::WebExternalPopupMenuClient; 305 using blink::WebExternalPopupMenuClient;
303 using blink::WebFindOptions; 306 using blink::WebFindOptions;
304 using blink::WebFrame; 307 using blink::WebFrame;
305 using blink::WebFrameLoadType; 308 using blink::WebFrameLoadType;
306 using blink::WebFrameSerializer; 309 using blink::WebFrameSerializer;
307 using blink::WebFrameSerializerClient; 310 using blink::WebFrameSerializerClient;
308 using blink::WebHistoryItem; 311 using blink::WebHistoryItem;
309 using blink::WebHTTPBody; 312 using blink::WebHTTPBody;
313 using blink::WebKeyLockRequestCompletion;
310 using blink::WebLocalFrame; 314 using blink::WebLocalFrame;
311 using blink::WebMediaPlayer; 315 using blink::WebMediaPlayer;
312 using blink::WebMediaPlayerClient; 316 using blink::WebMediaPlayerClient;
313 using blink::WebMediaPlayerEncryptedMediaClient; 317 using blink::WebMediaPlayerEncryptedMediaClient;
314 using blink::WebNavigationPolicy; 318 using blink::WebNavigationPolicy;
315 using blink::WebNavigationType; 319 using blink::WebNavigationType;
316 using blink::WebNode; 320 using blink::WebNode;
317 using blink::WebPluginDocument; 321 using blink::WebPluginDocument;
318 using blink::WebPluginParams; 322 using blink::WebPluginParams;
319 using blink::WebPoint; 323 using blink::WebPoint;
(...skipping 6484 matching lines...) Expand 10 before | Expand all | Expand 10 after
6804 local_root->render_widget_->is_hidden() 6808 local_root->render_widget_->is_hidden()
6805 ? blink::kWebPageVisibilityStateHidden 6809 ? blink::kWebPageVisibilityStateHidden
6806 : blink::kWebPageVisibilityStateVisible; 6810 : blink::kWebPageVisibilityStateVisible;
6807 blink::WebPageVisibilityState override_state = current_state; 6811 blink::WebPageVisibilityState override_state = current_state;
6808 if (GetContentClient()->renderer()->ShouldOverridePageVisibilityState( 6812 if (GetContentClient()->renderer()->ShouldOverridePageVisibilityState(
6809 this, &override_state)) 6813 this, &override_state))
6810 return override_state; 6814 return override_state;
6811 return current_state; 6815 return current_state;
6812 } 6816 }
6813 6817
6818 void RenderFrameImpl::RequestKeyLock(const WebVector<WebString>& key_codes,
6819 WebKeyLockRequestCompletion* completion) {
6820 std::vector<std::string> std_key_codes;
6821 for (const auto& key_code : key_codes) {
6822 // KeyboardEvent.code should be used; keys should be represented by latin
6823 // characters.
6824 std_key_codes.push_back(key_code.Latin1());
6825 }
6826 frame_host_->RequestKeyLock(
6827 std_key_codes, base::Bind(
6828 [](WebKeyLockRequestCompletion* completion,
6829 bool allowed, const base::string16& reason) {
6830 completion->DidCompleteRequest(
6831 allowed, WebString::FromUTF16(reason));
6832 },
6833 base::Unretained(completion)));
6834 }
6835
6836 void RenderFrameImpl::CancelKeyLock() {
6837 // The callback is not forwarded to web page.
6838 frame_host_->CancelKeyLock(base::Bind([] {}));
6839 }
6840
6814 blink::WebPageVisibilityState RenderFrameImpl::GetVisibilityState() const { 6841 blink::WebPageVisibilityState RenderFrameImpl::GetVisibilityState() const {
6815 return VisibilityState(); 6842 return VisibilityState();
6816 } 6843 }
6817 6844
6818 bool RenderFrameImpl::IsBrowserSideNavigationPending() { 6845 bool RenderFrameImpl::IsBrowserSideNavigationPending() {
6819 return browser_side_navigation_pending_; 6846 return browser_side_navigation_pending_;
6820 } 6847 }
6821 6848
6822 base::SingleThreadTaskRunner* RenderFrameImpl::GetTimerTaskRunner() { 6849 base::SingleThreadTaskRunner* RenderFrameImpl::GetTimerTaskRunner() {
6823 return GetWebFrame()->TimerTaskRunner(); 6850 return GetWebFrame()->TimerTaskRunner();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
6975 policy(info.default_policy), 7002 policy(info.default_policy),
6976 replaces_current_history_item(info.replaces_current_history_item), 7003 replaces_current_history_item(info.replaces_current_history_item),
6977 history_navigation_in_new_child_frame( 7004 history_navigation_in_new_child_frame(
6978 info.is_history_navigation_in_new_child_frame), 7005 info.is_history_navigation_in_new_child_frame),
6979 client_redirect(info.is_client_redirect), 7006 client_redirect(info.is_client_redirect),
6980 cache_disabled(info.is_cache_disabled), 7007 cache_disabled(info.is_cache_disabled),
6981 form(info.form), 7008 form(info.form),
6982 source_location(info.source_location) {} 7009 source_location(info.source_location) {}
6983 7010
6984 } // namespace content 7011 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698