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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 12189018: <webview>: Implement WebRequest API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Diff from latest patch Created 7 years, 10 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) 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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 const GURL& url = embedder_web_contents->GetSiteInstance()->GetSiteURL(); 680 const GURL& url = embedder_web_contents->GetSiteInstance()->GetSiteURL();
681 const Extension* extension = service->extensions()-> 681 const Extension* extension = service->extensions()->
682 GetExtensionOrAppByURL(ExtensionURLInfo(url)); 682 GetExtensionOrAppByURL(ExtensionURLInfo(url));
683 if (!extension) 683 if (!extension)
684 return; 684 return;
685 std::vector<ExtensionMsg_Loaded_Params> extensions; 685 std::vector<ExtensionMsg_Loaded_Params> extensions;
686 extensions.push_back(ExtensionMsg_Loaded_Params(extension)); 686 extensions.push_back(ExtensionMsg_Loaded_Params(extension));
687 guest_web_contents->Send(new ExtensionMsg_Loaded(extensions)); 687 guest_web_contents->Send(new ExtensionMsg_Loaded(extensions));
688 } 688 }
689 689
690 void ChromeContentBrowserClient::GuestWebContentsDestroyed(
691 WebContents* guest_web_contents, WebContents* embedder_web_contents) {
692 Profile* profile = Profile::FromBrowserContext(
693 embedder_web_contents->GetBrowserContext());
694 ExtensionService* service =
695 extensions::ExtensionSystem::Get(profile)->extension_service();
696 if (!service)
697 return;
698 const GURL& url = embedder_web_contents->GetSiteInstance()->GetSiteURL();
699 const Extension* extension = service->extensions()->
700 GetExtensionOrAppByURL(ExtensionURLInfo(url));
701 if (!extension)
702 return;
703
704 BrowserThread::PostTask(
705 BrowserThread::IO,
Matt Perry 2013/02/06 22:40:24 indent+2
Fady Samuel 2013/05/15 21:58:53 Done.
706 FROM_HERE,
707 base::Bind(
708 &ChromeContentBrowserClient::RemoveWebViewEventListenersOnIOThread,
709 base::Unretained(this), profile, extension->id(),
710 embedder_web_contents->GetRenderProcessHost()->GetID(),
711 embedder_web_contents->GetRoutingID(),
712 guest_web_contents->GetInstanceID()));
713 }
714
715 void ChromeContentBrowserClient::RemoveWebViewEventListenersOnIOThread(
Matt Perry 2013/02/06 22:40:24 nit: this sort of thing can be a global static fun
Fady Samuel 2013/05/15 21:58:53 Done.
716 void* profile,
717 const std::string& extension_id,
718 int embedder_process_id,
719 int embedder_routing_id,
720 int web_view_instance_id) {
721 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
722 ExtensionWebRequestEventRouter::GetInstance()->RemoveWebViewEventListeners(
723 profile, extension_id, embedder_process_id, embedder_routing_id,
Matt Perry 2013/02/06 22:40:24 indent+2
Fady Samuel 2013/05/15 21:58:53 Done.
724 web_view_instance_id);
725 }
726
690 void ChromeContentBrowserClient::RenderProcessHostCreated( 727 void ChromeContentBrowserClient::RenderProcessHostCreated(
691 content::RenderProcessHost* host) { 728 content::RenderProcessHost* host) {
692 int id = host->GetID(); 729 int id = host->GetID();
693 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); 730 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
694 host->GetChannel()->AddFilter(new ChromeRenderMessageFilter( 731 host->GetChannel()->AddFilter(new ChromeRenderMessageFilter(
695 id, profile, profile->GetRequestContextForRenderProcess(id))); 732 id, profile, profile->GetRequestContextForRenderProcess(id)));
696 #if defined(ENABLE_PLUGINS) 733 #if defined(ENABLE_PLUGINS)
697 host->GetChannel()->AddFilter(new PluginInfoMessageFilter(id, profile)); 734 host->GetChannel()->AddFilter(new PluginInfoMessageFilter(id, profile));
698 #endif 735 #endif
699 #if defined(ENABLE_PRINTING) 736 #if defined(ENABLE_PRINTING)
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 io_thread_application_locale_ = locale; 2077 io_thread_application_locale_ = locale;
2041 } 2078 }
2042 2079
2043 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread( 2080 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread(
2044 const std::string& locale) { 2081 const std::string& locale) {
2045 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 2082 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
2046 io_thread_application_locale_ = locale; 2083 io_thread_application_locale_ = locale;
2047 } 2084 }
2048 2085
2049 } // namespace chrome 2086 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698