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

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

Issue 28273006: <webview>: Implement declarativeWebRequest API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests Created 7 years, 1 month 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
OLDNEW
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/activity_log/activity_log.h" 10 #include "chrome/browser/extensions/activity_log/activity_log.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 void TabHelper::RenderViewCreated(RenderViewHost* render_view_host) { 192 void TabHelper::RenderViewCreated(RenderViewHost* render_view_host) {
193 SetTabId(render_view_host); 193 SetTabId(render_view_host);
194 } 194 }
195 195
196 void TabHelper::DidNavigateMainFrame( 196 void TabHelper::DidNavigateMainFrame(
197 const content::LoadCommittedDetails& details, 197 const content::LoadCommittedDetails& details,
198 const content::FrameNavigateParams& params) { 198 const content::FrameNavigateParams& params) {
199 #if defined(ENABLE_EXTENSIONS) 199 #if defined(ENABLE_EXTENSIONS)
200 if (ExtensionSystem::Get(profile_)->extension_service() && 200 if (ExtensionSystem::Get(profile_)->extension_service() &&
201 RulesRegistryService::Get(profile_)) { 201 RulesRegistryService::Get(profile_)) {
202 RulesRegistryService::Get(profile_)->content_rules_registry()-> 202 RulesRegistryService::Get(profile_)->GetContentRulesRegistry(
203 RulesRegistryService::WebViewKey(0, 0))->
203 DidNavigateMainFrame(web_contents(), details, params); 204 DidNavigateMainFrame(web_contents(), details, params);
204 } 205 }
205 #endif // defined(ENABLE_EXTENSIONS) 206 #endif // defined(ENABLE_EXTENSIONS)
206 207
207 if (details.is_in_page) 208 if (details.is_in_page)
208 return; 209 return;
209 210
210 Profile* profile = 211 Profile* profile =
211 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 212 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
212 ExtensionService* service = profile->GetExtensionService(); 213 ExtensionService* service = profile->GetExtensionService();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 executing_scripts_map, 345 executing_scripts_map,
345 on_page_id, 346 on_page_id,
346 on_url)); 347 on_url));
347 } 348 }
348 349
349 void TabHelper::OnWatchedPageChange( 350 void TabHelper::OnWatchedPageChange(
350 const std::vector<std::string>& css_selectors) { 351 const std::vector<std::string>& css_selectors) {
351 #if defined(ENABLE_EXTENSIONS) 352 #if defined(ENABLE_EXTENSIONS)
352 if (ExtensionSystem::Get(profile_)->extension_service() && 353 if (ExtensionSystem::Get(profile_)->extension_service() &&
353 RulesRegistryService::Get(profile_)) { 354 RulesRegistryService::Get(profile_)) {
354 RulesRegistryService::Get(profile_)->content_rules_registry()->Apply( 355 RulesRegistryService::Get(profile_)->GetContentRulesRegistry(
356 RulesRegistryService::WebViewKey(0, 0))->Apply(
355 web_contents(), css_selectors); 357 web_contents(), css_selectors);
356 } 358 }
357 #endif // defined(ENABLE_EXTENSIONS) 359 #endif // defined(ENABLE_EXTENSIONS)
358 } 360 }
359 361
360 void TabHelper::OnDetailedConsoleMessageAdded( 362 void TabHelper::OnDetailedConsoleMessageAdded(
361 const base::string16& message, 363 const base::string16& message,
362 const base::string16& source, 364 const base::string16& source,
363 const StackTrace& stack_trace, 365 const StackTrace& stack_trace,
364 int32 severity_level) { 366 int32 severity_level) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 486 }
485 } 487 }
486 488
487 void TabHelper::SetTabId(RenderViewHost* render_view_host) { 489 void TabHelper::SetTabId(RenderViewHost* render_view_host) {
488 render_view_host->Send( 490 render_view_host->Send(
489 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), 491 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(),
490 SessionID::IdForTab(web_contents()))); 492 SessionID::IdForTab(web_contents())));
491 } 493 }
492 494
493 } // namespace extensions 495 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698