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 "chrome/browser/extensions/tab_helper.h" | 5 #include "chrome/browser/extensions/tab_helper.h" |
6 | 6 |
7 #include "chrome/browser/extensions/activity_log.h" | 7 #include "chrome/browser/extensions/activity_log.h" |
8 #include "chrome/browser/extensions/app_notify_channel_ui.h" | 8 #include "chrome/browser/extensions/app_notify_channel_ui.h" |
9 #include "chrome/browser/extensions/crx_installer.h" | 9 #include "chrome/browser/extensions/crx_installer.h" |
10 #include "chrome/browser/extensions/extension_action.h" | 10 #include "chrome/browser/extensions/extension_action.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } else { | 96 } else { |
97 location_bar_controller_.reset( | 97 location_bar_controller_.reset( |
98 new PageActionController(web_contents)); | 98 new PageActionController(web_contents)); |
99 } | 99 } |
100 | 100 |
101 if (FeatureSwitch::script_bubble()->IsEnabled()) { | 101 if (FeatureSwitch::script_bubble()->IsEnabled()) { |
102 script_bubble_controller_.reset( | 102 script_bubble_controller_.reset( |
103 new ScriptBubbleController(web_contents, this)); | 103 new ScriptBubbleController(web_contents, this)); |
104 } | 104 } |
105 | 105 |
106 | |
107 // If more classes need to listen to global content script activity, then | 106 // If more classes need to listen to global content script activity, then |
108 // a separate routing class with an observer interface should be written. | 107 // a separate routing class with an observer interface should be written. |
109 profile_ = Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 108 AddScriptExecutionObserver(ActivityLog::GetInstance()); |
110 AddScriptExecutionObserver(ActivityLog::GetInstance(profile_)); | |
111 | 109 |
112 registrar_.Add(this, | 110 registrar_.Add(this, |
113 content::NOTIFICATION_LOAD_STOP, | 111 content::NOTIFICATION_LOAD_STOP, |
114 content::Source<NavigationController>( | 112 content::Source<NavigationController>( |
115 &web_contents->GetController())); | 113 &web_contents->GetController())); |
116 | 114 |
117 registrar_.Add(this, | 115 registrar_.Add(this, |
118 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 116 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
119 content::NotificationService::AllSources()); | 117 content::NotificationService::AllSources()); |
120 } | 118 } |
121 | 119 |
122 TabHelper::~TabHelper() { | 120 TabHelper::~TabHelper() { |
123 RemoveScriptExecutionObserver(ActivityLog::GetInstance(profile_)); | 121 RemoveScriptExecutionObserver(ActivityLog::GetInstance()); |
124 } | 122 } |
125 | 123 |
126 void TabHelper::CreateApplicationShortcuts() { | 124 void TabHelper::CreateApplicationShortcuts() { |
127 DCHECK(CanCreateApplicationShortcuts()); | 125 DCHECK(CanCreateApplicationShortcuts()); |
128 NavigationEntry* entry = | 126 NavigationEntry* entry = |
129 web_contents()->GetController().GetLastCommittedEntry(); | 127 web_contents()->GetController().GetLastCommittedEntry(); |
130 if (!entry) | 128 if (!entry) |
131 return; | 129 return; |
132 | 130 |
133 pending_web_app_action_ = CREATE_SHORTCUT; | 131 pending_web_app_action_ = CREATE_SHORTCUT; |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 script_bubble_controller_->OnExtensionUnloaded( | 512 script_bubble_controller_->OnExtensionUnloaded( |
515 content::Details<extensions::UnloadedExtensionInfo>( | 513 content::Details<extensions::UnloadedExtensionInfo>( |
516 details)->extension->id()); | 514 details)->extension->id()); |
517 break; | 515 break; |
518 } | 516 } |
519 } | 517 } |
520 } | 518 } |
521 } | 519 } |
522 | 520 |
523 } // namespace extensions | 521 } // namespace extensions |
OLD | NEW |