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