OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/task_manager/web_contents_information.h" | 5 #include "chrome/browser/task_manager/web_contents_information.h" |
6 #include "content/public/browser/notification_service.h" | 6 #include "content/public/browser/notification_service.h" |
7 #include "content/public/browser/notification_types.h" | 7 #include "content/public/browser/notification_types.h" |
8 | 8 |
9 namespace task_manager { | 9 namespace task_manager { |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 this, | 31 this, |
32 content::NOTIFICATION_WEB_CONTENTS_CONNECTED, | 32 content::NOTIFICATION_WEB_CONTENTS_CONNECTED, |
33 content::NotificationService::AllBrowserContextsAndSources()); | 33 content::NotificationService::AllBrowserContextsAndSources()); |
34 observer_callback_.Reset(); | 34 observer_callback_.Reset(); |
35 } | 35 } |
36 | 36 |
37 void NotificationObservingWebContentsInformation::Observe( | 37 void NotificationObservingWebContentsInformation::Observe( |
38 int type, | 38 int type, |
39 const content::NotificationSource& source, | 39 const content::NotificationSource& source, |
40 const content::NotificationDetails& details) { | 40 const content::NotificationDetails& details) { |
| 41 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_CONNECTED, type); |
| 42 |
41 content::WebContents* web_contents = | 43 content::WebContents* web_contents = |
42 content::Source<content::WebContents>(source).ptr(); | 44 content::Source<content::WebContents>(source).ptr(); |
43 | 45 if (CheckOwnership(web_contents)) |
44 switch (type) { | 46 observer_callback_.Run(web_contents); |
45 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED: | |
46 if (CheckOwnership(web_contents)) | |
47 observer_callback_.Run(web_contents); | |
48 break; | |
49 } | |
50 } | 47 } |
51 | 48 |
52 } // namespace task_manager | 49 } // namespace task_manager |
OLD | NEW |