Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / automation / automation_tab_tracker.cc
blob1add4004b58b531efd6bc3dbcebc0e5d2385126f
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
3 // found in the LICENSE file.
5 #include "chrome/browser/automation/automation_tab_tracker.h"
7 #include "base/logging.h"
8 #include "chrome/browser/chrome_notification_types.h"
9 #include "content/public/browser/navigation_controller.h"
10 #include "content/public/browser/notification_source.h"
12 using content::NavigationController;
14 AutomationTabTracker::AutomationTabTracker(IPC::Sender* automation)
15 : AutomationResourceTracker<NavigationController*>(automation) {
18 AutomationTabTracker::~AutomationTabTracker() {
21 void AutomationTabTracker::AddObserver(NavigationController* resource) {
22 // This tab could either be a regular tab or an external tab
23 // Register for both notifications.
24 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING,
25 content::Source<NavigationController>(resource));
28 void AutomationTabTracker::RemoveObserver(NavigationController* resource) {
29 registrar_.Remove(this, chrome::NOTIFICATION_TAB_CLOSING,
30 content::Source<NavigationController>(resource));
33 void AutomationTabTracker::Observe(
34 int type,
35 const content::NotificationSource& source,
36 const content::NotificationDetails& details) {
37 switch (type) {
38 case chrome::NOTIFICATION_TAB_CLOSING:
39 break;
40 default:
41 NOTREACHED();
43 AutomationResourceTracker<NavigationController*>::Observe(
44 type, source, details);