| OLD | NEW |
| 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 "base/bind_helpers.h" | 5 #include "base/bind_helpers.h" |
| 6 #include "base/location.h" | 6 #include "base/location.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 void set_quit_closure(const base::Closure& quit_closure) { | 48 void set_quit_closure(const base::Closure& quit_closure) { |
| 49 quit_closure_ = quit_closure; | 49 quit_closure_ = quit_closure; |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 // content::WebContentsObserver implementation. | 53 // content::WebContentsObserver implementation. |
| 54 bool OnMessageReceived(const IPC::Message& message) override { | 54 bool OnMessageReceived(const IPC::Message& message) override { |
| 55 IPC_BEGIN_MESSAGE_MAP(RequestPrintPreviewObserver, message) | 55 IPC_BEGIN_MESSAGE_MAP(RequestPrintPreviewObserver, message) |
| 56 IPC_MESSAGE_HANDLER(PrintHostMsg_RequestPrintPreview, | 56 IPC_MESSAGE_HANDLER(PrintHostMsg_RequestPrintPreview, |
| 57 OnRequestPrintPreview) | 57 OnRequestPrintPreview) |
| 58 IPC_MESSAGE_UNHANDLED(break;) | 58 IPC_MESSAGE_UNHANDLED(break) |
| 59 IPC_END_MESSAGE_MAP(); | 59 IPC_END_MESSAGE_MAP() |
| 60 return false; // Report not handled so the real handler receives it. | 60 return false; // Report not handled so the real handler receives it. |
| 61 } | 61 } |
| 62 | 62 |
| 63 void OnRequestPrintPreview( | 63 void OnRequestPrintPreview( |
| 64 const PrintHostMsg_RequestPrintPreview_Params& /* params */) { | 64 const PrintHostMsg_RequestPrintPreview_Params& /* params */) { |
| 65 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_); | 65 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_); |
| 66 } | 66 } |
| 67 | 67 |
| 68 base::Closure quit_closure_; | 68 base::Closure quit_closure_; |
| 69 | 69 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 EXPECT_EQ(task_management::Task::RENDERER, task->GetType()); | 388 EXPECT_EQ(task_management::Task::RENDERER, task->GetType()); |
| 389 const base::string16 title = task->title(); | 389 const base::string16 title = task->title(); |
| 390 EXPECT_TRUE(base::StartsWith(title, | 390 EXPECT_TRUE(base::StartsWith(title, |
| 391 expected_prefix, | 391 expected_prefix, |
| 392 base::CompareCase::INSENSITIVE_ASCII)); | 392 base::CompareCase::INSENSITIVE_ASCII)); |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace | 395 } // namespace |
| 396 | 396 |
| 397 #endif // defined(ENABLE_TASK_MANAGER) | 397 #endif // defined(ENABLE_TASK_MANAGER) |
| OLD | NEW |