Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / task_manager / web_contents_information.cc
blobc82cd1697cb747c795dc194713f6cc3615583fbc
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
3 // found in the LICENSE file.
5 #include "chrome/browser/task_manager/web_contents_information.h"
6 #include "content/public/browser/notification_service.h"
7 #include "content/public/browser/notification_types.h"
9 namespace task_manager {
11 WebContentsInformation::WebContentsInformation() {}
13 WebContentsInformation::~WebContentsInformation() {}
15 NotificationObservingWebContentsInformation::
16 NotificationObservingWebContentsInformation() {}
18 NotificationObservingWebContentsInformation::
19 ~NotificationObservingWebContentsInformation() {}
21 void NotificationObservingWebContentsInformation::StartObservingCreation(
22 const NewWebContentsCallback& callback) {
23 observer_callback_ = callback;
24 registrar_.Add(this,
25 content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
26 content::NotificationService::AllBrowserContextsAndSources());
29 void NotificationObservingWebContentsInformation::StopObservingCreation() {
30 registrar_.Remove(
31 this,
32 content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
33 content::NotificationService::AllBrowserContextsAndSources());
34 observer_callback_.Reset();
37 void NotificationObservingWebContentsInformation::Observe(
38 int type,
39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) {
41 content::WebContents* web_contents =
42 content::Source<content::WebContents>(source).ptr();
44 switch (type) {
45 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED:
46 if (CheckOwnership(web_contents))
47 observer_callback_.Run(web_contents);
48 break;
52 } // namespace task_manager