Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: chrome/browser/extensions/extension_tab_helper.cc

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: works now Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extension_tab_helper.h" 5 #include "chrome/browser/extensions/extension_tab_helper.h"
6 6
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sessions/restore_tab_helper.h" 9 #include "chrome/browser/sessions/restore_tab_helper.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, 56 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
57 Source<ExtensionTabHelper>(this), 57 Source<ExtensionTabHelper>(this),
58 NotificationService::NoDetails()); 58 NotificationService::NoDetails());
59 } 59 }
60 60
61 void ExtensionTabHelper::SetExtensionAppById( 61 void ExtensionTabHelper::SetExtensionAppById(
62 const std::string& extension_app_id) { 62 const std::string& extension_app_id) {
63 if (extension_app_id.empty()) 63 if (extension_app_id.empty())
64 return; 64 return;
65 65
66 ExtensionService* extension_service = 66 Profile* profile = static_cast<Profile*>(tab_contents()->context());
67 tab_contents()->profile()->GetExtensionService(); 67 ExtensionService* extension_service = profile->GetExtensionService();
68 if (!extension_service || !extension_service->is_ready()) 68 if (!extension_service || !extension_service->is_ready())
69 return; 69 return;
70 70
71 const Extension* extension = 71 const Extension* extension =
72 extension_service->GetExtensionById(extension_app_id, false); 72 extension_service->GetExtensionById(extension_app_id, false);
73 if (extension) 73 if (extension)
74 SetExtensionApp(extension); 74 SetExtensionApp(extension);
75 } 75 }
76 76
77 SkBitmap* ExtensionTabHelper::GetExtensionAppIcon() { 77 SkBitmap* ExtensionTabHelper::GetExtensionAppIcon() {
78 if (extension_app_icon_.empty()) 78 if (extension_app_icon_.empty())
79 return NULL; 79 return NULL;
80 80
81 return &extension_app_icon_; 81 return &extension_app_icon_;
82 } 82 }
83 83
84 void ExtensionTabHelper::DidNavigateMainFramePostCommit( 84 void ExtensionTabHelper::DidNavigateMainFramePostCommit(
85 const content::LoadCommittedDetails& details, 85 const content::LoadCommittedDetails& details,
86 const ViewHostMsg_FrameNavigate_Params& params) { 86 const ViewHostMsg_FrameNavigate_Params& params) {
87 if (details.is_in_page) 87 if (details.is_in_page)
88 return; 88 return;
89 89
90 ExtensionService* service = tab_contents()->profile()->GetExtensionService(); 90 Profile* profile = static_cast<Profile*>(tab_contents()->context());
91 ExtensionService* service = profile->GetExtensionService();
91 if (!service) 92 if (!service)
92 return; 93 return;
93 94
94 for (size_t i = 0; i < service->extensions()->size(); ++i) { 95 for (size_t i = 0; i < service->extensions()->size(); ++i) {
95 ExtensionAction* browser_action = 96 ExtensionAction* browser_action =
96 service->extensions()->at(i)->browser_action(); 97 service->extensions()->at(i)->browser_action();
97 if (browser_action) { 98 if (browser_action) {
98 browser_action->ClearAllValuesForTab( 99 browser_action->ClearAllValuesForTab(
99 wrapper_->restore_tab_helper()->session_id().id()); 100 wrapper_->restore_tab_helper()->session_id().id());
100 NotificationService::current()->Notify( 101 NotificationService::current()->Notify(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (tab_contents_delegate) 203 if (tab_contents_delegate)
203 return tab_contents_delegate->GetFrameNativeWindow(); 204 return tab_contents_delegate->GetFrameNativeWindow();
204 else 205 else
205 return NULL; 206 return NULL;
206 } 207 }
207 208
208 gfx::NativeView ExtensionTabHelper::GetNativeViewOfHost() { 209 gfx::NativeView ExtensionTabHelper::GetNativeViewOfHost() {
209 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); 210 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView();
210 return rwhv ? rwhv->GetNativeView() : NULL; 211 return rwhv ? rwhv->GetNativeView() : NULL;
211 } 212 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698