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

Unified Diff: content/browser/host_zoom_map_impl.cc

Issue 9416070: Move creation and ownership of HostZoomMap to content instead of having every embedder do this. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac/cros browsertests Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/host_zoom_map_impl.h ('k') | content/browser/host_zoom_map_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/host_zoom_map_impl.cc
===================================================================
--- content/browser/host_zoom_map_impl.cc (revision 122827)
+++ content/browser/host_zoom_map_impl.cc (working copy)
@@ -16,6 +16,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
+#include "content/public/browser/resource_context.h"
#include "content/public/common/page_zoom.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_util.h"
@@ -25,10 +26,18 @@
using content::BrowserThread;
using content::RenderProcessHost;
+static const char* kHostZoomMapKeyName = "content_host_zoom_map";
+
namespace content {
-HostZoomMap* HostZoomMap::Create() {
- return new HostZoomMapImpl();
+HostZoomMap* HostZoomMap::GetForBrowserContext(BrowserContext* context) {
+ HostZoomMapImpl* rv = static_cast<HostZoomMapImpl*>(
+ context->GetUserData(kHostZoomMapKeyName));
+ if (!rv) {
+ rv = new HostZoomMapImpl();
+ context->SetUserData(kHostZoomMapKeyName, rv);
+ }
+ return rv;
}
} // namespace content
@@ -77,7 +86,8 @@
for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
!i.IsAtEnd(); i.Advance()) {
RenderProcessHost* render_process_host = i.GetCurrentValue();
- if (render_process_host->GetBrowserContext()->GetHostZoomMap() == this) {
+ if (HostZoomMap::GetForBrowserContext(
+ render_process_host->GetBrowserContext()) == this) {
render_process_host->Send(
new ViewMsg_SetZoomLevelForCurrentURL(host, level));
}
@@ -149,8 +159,6 @@
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
switch (type) {
case content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW: {
base::AutoLock auto_lock(lock_);
« no previous file with comments | « content/browser/host_zoom_map_impl.h ('k') | content/browser/host_zoom_map_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698