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

Side by Side Diff: content/public/test/browser_test_utils.cc

Issue 1934703002: Fix keyboard focus for OOPIF-<webview>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nasko@ comments. Created 4 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
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/public/test/browser_test_utils.h" 5 #include "content/public/test/browser_test_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 1500 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
1501 RunTaskOnIOThreadAndWait(base::Bind(&BrowserTestClipboardScope::SetText, 1501 RunTaskOnIOThreadAndWait(base::Bind(&BrowserTestClipboardScope::SetText,
1502 base::Unretained(this), text)); 1502 base::Unretained(this), text));
1503 return; 1503 return;
1504 } 1504 }
1505 #endif 1505 #endif
1506 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_COPY_PASTE); 1506 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_COPY_PASTE);
1507 clipboard_writer.WriteText(base::ASCIIToUTF16(text)); 1507 clipboard_writer.WriteText(base::ASCIIToUTF16(text));
1508 } 1508 }
1509 1509
1510 class FrameFocusedObserver::FrameTreeNodeObserverImpl
1511 : public FrameTreeNode::Observer {
1512 public:
1513 explicit FrameTreeNodeObserverImpl(FrameTreeNode* owner)
1514 : owner_(owner), message_loop_runner_(new MessageLoopRunner) {
1515 owner->AddObserver(this);
1516 }
1517 ~FrameTreeNodeObserverImpl() override { owner_->RemoveObserver(this); }
1518
1519 void Run() { message_loop_runner_->Run(); }
1520
1521 void OnFrameTreeNodeFocused(FrameTreeNode* node) override {
1522 if (node == owner_)
1523 message_loop_runner_->Quit();
1524 }
1525
1526 private:
1527 FrameTreeNode* owner_;
1528 scoped_refptr<MessageLoopRunner> message_loop_runner_;
1529 };
1530
1531 FrameFocusedObserver::FrameFocusedObserver(RenderFrameHost* owner_host)
1532 : impl_(new FrameTreeNodeObserverImpl(
1533 static_cast<RenderFrameHostImpl*>(owner_host)->frame_tree_node())) {}
1534
1535 FrameFocusedObserver::~FrameFocusedObserver() {}
1536
1537 void FrameFocusedObserver::Wait() {
1538 impl_->Run();
1539 }
1540
1510 } // namespace content 1541 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698