OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser/renderer_host/media/web_contents_tracker.h" | 5 #include "content/browser/renderer_host/media/web_contents_tracker.h" |
6 | 6 |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 WebContentsTracker::WebContentsTracker() {} | 15 WebContentsTracker::WebContentsTracker() {} |
16 | 16 |
17 WebContentsTracker::~WebContentsTracker() { | 17 WebContentsTracker::~WebContentsTracker() { |
18 DCHECK(!web_contents()) << "BUG: Still observering!"; | 18 DCHECK(!web_contents()) << "BUG: Still observering!"; |
19 } | 19 } |
20 | 20 |
21 void WebContentsTracker::Start(int render_process_id, int render_view_id, | 21 void WebContentsTracker::Start(int render_process_id, int render_view_id, |
22 const ChangeCallback& callback) { | 22 const ChangeCallback& callback) { |
23 DCHECK(!message_loop_ || message_loop_->BelongsToCurrentThread()); | 23 DCHECK(!message_loop_.get() || message_loop_->BelongsToCurrentThread()); |
24 | 24 |
25 message_loop_ = base::MessageLoopProxy::current(); | 25 message_loop_ = base::MessageLoopProxy::current(); |
26 DCHECK(message_loop_); | 26 DCHECK(message_loop_.get()); |
27 callback_ = callback; | 27 callback_ = callback; |
28 | 28 |
29 BrowserThread::PostTask( | 29 BrowserThread::PostTask( |
30 BrowserThread::UI, FROM_HERE, | 30 BrowserThread::UI, FROM_HERE, |
31 base::Bind(&WebContentsTracker::LookUpAndObserveWebContents, this, | 31 base::Bind(&WebContentsTracker::LookUpAndObserveWebContents, this, |
32 render_process_id, render_view_id)); | 32 render_process_id, render_view_id)); |
33 } | 33 } |
34 | 34 |
35 void WebContentsTracker::Stop() { | 35 void WebContentsTracker::Stop() { |
36 DCHECK(message_loop_->BelongsToCurrentThread()); | 36 DCHECK(message_loop_->BelongsToCurrentThread()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void WebContentsTracker::DidNavigateMainFrame( | 93 void WebContentsTracker::DidNavigateMainFrame( |
94 const LoadCommittedDetails& details, const FrameNavigateParams& params) { | 94 const LoadCommittedDetails& details, const FrameNavigateParams& params) { |
95 OnWebContentsChangeEvent(); | 95 OnWebContentsChangeEvent(); |
96 } | 96 } |
97 | 97 |
98 void WebContentsTracker::WebContentsDestroyed(WebContents* web_contents) { | 98 void WebContentsTracker::WebContentsDestroyed(WebContents* web_contents) { |
99 OnWebContentsChangeEvent(); | 99 OnWebContentsChangeEvent(); |
100 } | 100 } |
101 | 101 |
102 } // namespace content | 102 } // namespace content |
OLD | NEW |