| OLD | NEW |
| 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 "content/browser/frame_host/interstitial_page_impl.h" | 5 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 6 | 6 |
| 7 #include <tuple> |
| 8 |
| 7 #include "base/macros.h" | 9 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 10 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 11 #include "content/browser/web_contents/web_contents_impl.h" | 13 #include "content/browser/web_contents/web_contents_impl.h" |
| 12 #include "content/common/clipboard_messages.h" | 14 #include "content/common/clipboard_messages.h" |
| 13 #include "content/common/frame_messages.h" | 15 #include "content/common/frame_messages.h" |
| 14 #include "content/public/browser/browser_message_filter.h" | 16 #include "content/public/browser/browser_message_filter.h" |
| 15 #include "content/public/browser/interstitial_page_delegate.h" | 17 #include "content/public/browser/interstitial_page_delegate.h" |
| 16 #include "content/public/test/browser_test_utils.h" | 18 #include "content/public/test/browser_test_utils.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 bool OnMessageReceived(const IPC::Message& message) override { | 96 bool OnMessageReceived(const IPC::Message& message) override { |
| 95 if (!run_loop_) | 97 if (!run_loop_) |
| 96 return false; | 98 return false; |
| 97 | 99 |
| 98 if (message.type() == FrameHostMsg_UpdateTitle::ID) { | 100 if (message.type() == FrameHostMsg_UpdateTitle::ID) { |
| 99 FrameHostMsg_UpdateTitle::Param params; | 101 FrameHostMsg_UpdateTitle::Param params; |
| 100 if (FrameHostMsg_UpdateTitle::Read(&message, ¶ms)) { | 102 if (FrameHostMsg_UpdateTitle::Read(&message, ¶ms)) { |
| 101 BrowserThread::PostTask( | 103 BrowserThread::PostTask( |
| 102 BrowserThread::UI, FROM_HERE, | 104 BrowserThread::UI, FROM_HERE, |
| 103 base::Bind(&InterstitialTitleUpdateWatcher::OnTitleUpdateReceived, | 105 base::Bind(&InterstitialTitleUpdateWatcher::OnTitleUpdateReceived, |
| 104 this, base::get<0>(params))); | 106 this, std::get<0>(params))); |
| 105 } | 107 } |
| 106 } | 108 } |
| 107 return false; | 109 return false; |
| 108 } | 110 } |
| 109 | 111 |
| 110 base::string16 expected_title_; | 112 base::string16 expected_title_; |
| 111 std::unique_ptr<base::RunLoop> run_loop_; | 113 std::unique_ptr<base::RunLoop> run_loop_; |
| 112 | 114 |
| 113 DISALLOW_COPY_AND_ASSIGN(InterstitialTitleUpdateWatcher); | 115 DISALLOW_COPY_AND_ASSIGN(InterstitialTitleUpdateWatcher); |
| 114 }; | 116 }; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 bool OnMessageReceived(const IPC::Message& message) override { | 151 bool OnMessageReceived(const IPC::Message& message) override { |
| 150 if (!run_loop_) | 152 if (!run_loop_) |
| 151 return false; | 153 return false; |
| 152 | 154 |
| 153 if (message.type() == ClipboardHostMsg_WriteText::ID) { | 155 if (message.type() == ClipboardHostMsg_WriteText::ID) { |
| 154 ClipboardHostMsg_WriteText::Param params; | 156 ClipboardHostMsg_WriteText::Param params; |
| 155 if (ClipboardHostMsg_WriteText::Read(&message, ¶ms)) { | 157 if (ClipboardHostMsg_WriteText::Read(&message, ¶ms)) { |
| 156 BrowserThread::PostTask( | 158 BrowserThread::PostTask( |
| 157 BrowserThread::UI, FROM_HERE, | 159 BrowserThread::UI, FROM_HERE, |
| 158 base::Bind(&ClipboardMessageWatcher::OnWriteText, this, | 160 base::Bind(&ClipboardMessageWatcher::OnWriteText, this, |
| 159 base::UTF16ToUTF8(base::get<1>(params)))); | 161 base::UTF16ToUTF8(std::get<1>(params)))); |
| 160 } | 162 } |
| 161 return true; | 163 return true; |
| 162 } | 164 } |
| 163 if (message.type() == ClipboardHostMsg_CommitWrite::ID) { | 165 if (message.type() == ClipboardHostMsg_CommitWrite::ID) { |
| 164 BrowserThread::PostTask( | 166 BrowserThread::PostTask( |
| 165 BrowserThread::UI, FROM_HERE, | 167 BrowserThread::UI, FROM_HERE, |
| 166 base::Bind(&ClipboardMessageWatcher::OnCommitWrite, this)); | 168 base::Bind(&ClipboardMessageWatcher::OnCommitWrite, this)); |
| 167 return true; | 169 return true; |
| 168 } | 170 } |
| 169 return false; | 171 return false; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 EXPECT_EQ(std::string(), input_text); | 395 EXPECT_EQ(std::string(), input_text); |
| 394 | 396 |
| 395 PerformSelectAll(); | 397 PerformSelectAll(); |
| 396 ASSERT_TRUE(GetSelection(&input_text)); | 398 ASSERT_TRUE(GetSelection(&input_text)); |
| 397 EXPECT_EQ("original body text", input_text); | 399 EXPECT_EQ("original body text", input_text); |
| 398 | 400 |
| 399 TearDownInterstitialPage(); | 401 TearDownInterstitialPage(); |
| 400 } | 402 } |
| 401 | 403 |
| 402 } // namespace content | 404 } // namespace content |
| OLD | NEW |