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

Side by Side Diff: chrome/browser/ui/zoom/zoom_controller.cc

Issue 11040031: Fix zoom icon/bubble for virtual URLs (i.e. chrome://settings). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: doc Created 8 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/zoom/zoom_controller.h" 5 #include "chrome/browser/ui/zoom/zoom_controller.h"
6 6
7 #include "chrome/browser/prefs/pref_service.h" 7 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents.h"
11 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
12 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
13 #include "content/public/browser/host_zoom_map.h" 13 #include "content/public/browser/host_zoom_map.h"
14 #include "content/public/browser/navigation_entry.h"
14 #include "content/public/browser/notification_types.h" 15 #include "content/public/browser/notification_types.h"
15 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
16 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/page_zoom.h" 19 #include "content/public/common/page_zoom.h"
19 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
20 #include "net/base/net_util.h" 21 #include "net/base/net_util.h"
21 22
22 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ZoomController) 23 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ZoomController)
23 24
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 74 }
74 case content::NOTIFICATION_ZOOM_LEVEL_CHANGED: 75 case content::NOTIFICATION_ZOOM_LEVEL_CHANGED:
75 UpdateState(*content::Details<std::string>(details).ptr()); 76 UpdateState(*content::Details<std::string>(details).ptr());
76 break; 77 break;
77 default: 78 default:
78 NOTREACHED(); 79 NOTREACHED();
79 } 80 }
80 } 81 }
81 82
82 void ZoomController::UpdateState(const std::string& host) { 83 void ZoomController::UpdateState(const std::string& host) {
83 if (!host.empty() && 84 if (host.empty())
84 host != net::GetHostOrSpecFromURL(web_contents()->GetURL())) { 85 return;
86
87 // Use the active navigation entry's URL instead of the WebContents' so
88 // virtual URLs work (e.g. chrome://settings). http://crbug.com/153950
89 content::NavigationEntry* active_entry =
90 web_contents()->GetController().GetActiveEntry();
91 if (!active_entry ||
92 host != net::GetHostOrSpecFromURL(active_entry->GetURL())) {
85 return; 93 return;
86 } 94 }
87 95
88 bool dummy; 96 bool dummy;
89 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy); 97 zoom_percent_ = web_contents()->GetZoomPercent(&dummy, &dummy);
90 98
91 if (observer_) 99 if (observer_)
92 observer_->OnZoomChanged(web_contents(), !host.empty()); 100 observer_->OnZoomChanged(web_contents(), !host.empty());
93 } 101 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698