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 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING, | 155 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING, |
156 content::Source<content::BrowserContext>(profile)); | 156 content::Source<content::BrowserContext>(profile)); |
157 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, | 157 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, |
158 content::Source<content::BrowserContext>(profile)); | 158 content::Source<content::BrowserContext>(profile)); |
159 | 159 |
160 event_page_idle_time_ = base::TimeDelta::FromSeconds(10); | 160 event_page_idle_time_ = base::TimeDelta::FromSeconds(10); |
161 unsigned idle_time_sec = 0; | 161 unsigned idle_time_sec = 0; |
162 if (base::StringToUint(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 162 if (base::StringToUint(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
163 switches::kEventPageIdleTime), &idle_time_sec)) { | 163 switches::kEventPageIdleTime), &idle_time_sec)) { |
164 event_page_idle_time_ = base::TimeDelta::FromSeconds(idle_time_sec); | 164 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; | 580 break; |
581 } | 581 } |
582 | 582 |
583 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED: { | 583 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED: { |
584 content::WebContents* contents = | 584 content::WebContents* contents = |
585 content::Source<content::WebContents>(source).ptr(); | 585 content::Source<content::WebContents>(source).ptr(); |
586 UpdateRegisteredRenderView(contents->GetRenderViewHost()); | 586 UpdateRegisteredRenderView(contents->GetRenderViewHost()); |
587 break; | 587 break; |
588 } | 588 } |
589 | 589 |
590 case content::NOTIFICATION_APP_TERMINATING: { | 590 case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
591 // Close background hosts when the last browser is closed so that they | 591 // Close background hosts when the last browser is closed so that they |
592 // have time to shutdown various objects on different threads. Our | 592 // have time to shutdown various objects on different threads. Our |
593 // destructor is called too late in the shutdown sequence. | 593 // destructor is called too late in the shutdown sequence. |
594 CloseBackgroundHosts(); | 594 CloseBackgroundHosts(); |
595 break; | 595 break; |
596 } | 596 } |
597 | 597 |
598 case content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING: { | 598 case content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING: { |
599 RenderViewHost* render_view_host = | 599 RenderViewHost* render_view_host = |
600 content::Details<RenderViewHost>(details).ptr(); | 600 content::Details<RenderViewHost>(details).ptr(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 if (service && service->is_ready()) | 778 if (service && service->is_ready()) |
779 CreateBackgroundHostsForProfileStartup(this, service->extensions()); | 779 CreateBackgroundHostsForProfileStartup(this, service->extensions()); |
780 } | 780 } |
781 break; | 781 break; |
782 } | 782 } |
783 default: | 783 default: |
784 ExtensionProcessManager::Observe(type, source, details); | 784 ExtensionProcessManager::Observe(type, source, details); |
785 break; | 785 break; |
786 } | 786 } |
787 } | 787 } |
OLD | NEW |