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.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 143 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
144 content::Source<Profile>(original_profile)); | 144 content::Source<Profile>(original_profile)); |
145 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 145 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
146 content::Source<Profile>(original_profile)); | 146 content::Source<Profile>(original_profile)); |
147 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 147 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
148 content::Source<Profile>(profile)); | 148 content::Source<Profile>(profile)); |
149 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 149 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
150 content::Source<Profile>(profile)); | 150 content::Source<Profile>(profile)); |
151 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, | 151 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, |
152 content::NotificationService::AllSources()); | 152 content::NotificationService::AllSources()); |
153 registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, | 153 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
154 content::NotificationService::AllSources()); | 154 content::Source<Profile>(profile)); |
| 155 if (profile->IsOffTheRecord()) { |
| 156 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 157 content::Source<Profile>(original_profile)); |
| 158 } |
155 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING, | 159 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING, |
156 content::Source<content::BrowserContext>(profile)); | 160 content::Source<content::BrowserContext>(profile)); |
157 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, | 161 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, |
158 content::Source<content::BrowserContext>(profile)); | 162 content::Source<content::BrowserContext>(profile)); |
159 | 163 |
160 event_page_idle_time_ = base::TimeDelta::FromSeconds(10); | 164 event_page_idle_time_ = base::TimeDelta::FromSeconds(10); |
161 unsigned idle_time_sec = 0; | 165 unsigned idle_time_sec = 0; |
162 if (base::StringToUint(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 166 if (base::StringToUint(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
163 switches::kEventPageIdleTime), &idle_time_sec)) { | 167 switches::kEventPageIdleTime), &idle_time_sec)) { |
164 event_page_idle_time_ = base::TimeDelta::FromSeconds(idle_time_sec); | 168 event_page_idle_time_ = base::TimeDelta::FromSeconds(idle_time_sec); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 break; | 584 break; |
581 } | 585 } |
582 | 586 |
583 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED: { | 587 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED: { |
584 content::WebContents* contents = | 588 content::WebContents* contents = |
585 content::Source<content::WebContents>(source).ptr(); | 589 content::Source<content::WebContents>(source).ptr(); |
586 UpdateRegisteredRenderView(contents->GetRenderViewHost()); | 590 UpdateRegisteredRenderView(contents->GetRenderViewHost()); |
587 break; | 591 break; |
588 } | 592 } |
589 | 593 |
590 case content::NOTIFICATION_APP_TERMINATING: { | 594 case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
591 // Close background hosts when the last browser is closed so that they | 595 // Close background hosts when the last browser is closed so that they |
592 // have time to shutdown various objects on different threads. Our | 596 // have time to shutdown various objects on different threads. Our |
593 // destructor is called too late in the shutdown sequence. | 597 // destructor is called too late in the shutdown sequence. |
594 CloseBackgroundHosts(); | 598 CloseBackgroundHosts(); |
595 break; | 599 break; |
596 } | 600 } |
597 | 601 |
598 case content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING: { | 602 case content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING: { |
599 RenderViewHost* render_view_host = | 603 RenderViewHost* render_view_host = |
600 content::Details<RenderViewHost>(details).ptr(); | 604 content::Details<RenderViewHost>(details).ptr(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 if (service && service->is_ready()) | 782 if (service && service->is_ready()) |
779 CreateBackgroundHostsForProfileStartup(this, service->extensions()); | 783 CreateBackgroundHostsForProfileStartup(this, service->extensions()); |
780 } | 784 } |
781 break; | 785 break; |
782 } | 786 } |
783 default: | 787 default: |
784 ExtensionProcessManager::Observe(type, source, details); | 788 ExtensionProcessManager::Observe(type, source, details); |
785 break; | 789 break; |
786 } | 790 } |
787 } | 791 } |
OLD | NEW |