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

Unified Diff: chrome/browser/profiles/off_the_record_profile_impl_unittest.cc

Issue 9296041: Create Content API around HostZoomMap. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 | « chrome/browser/profiles/off_the_record_profile_impl.cc ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
===================================================================
--- chrome/browser/profiles/off_the_record_profile_impl_unittest.cc (revision 119530)
+++ chrome/browser/profiles/off_the_record_profile_impl_unittest.cc (working copy)
@@ -12,11 +12,13 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_pref_service.h"
#include "chrome/test/base/testing_profile.h"
-#include "content/browser/host_zoom_map.h"
+#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
+using content::HostZoomMap;
+
namespace {
class TestingProfileWithHostZoomMap : public TestingProfile,
@@ -28,7 +30,7 @@
virtual HostZoomMap* GetHostZoomMap() {
if (!host_zoom_map_) {
- host_zoom_map_ = new HostZoomMap();
+ host_zoom_map_ = HostZoomMap::Create();
registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
content::Source<HostZoomMap>(host_zoom_map_));
@@ -51,18 +53,18 @@
const content::NotificationDetails& details) OVERRIDE {
const std::string& host =
*(content::Details<const std::string>(details).ptr());
- if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) {
- if (!host.empty()) {
- double level = host_zoom_map_->GetZoomLevel(host);
- DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels);
- DictionaryValue* host_zoom_dictionary = update.Get();
- if (level == host_zoom_map_->default_zoom_level()) {
- host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL);
- } else {
- host_zoom_dictionary->SetWithoutPathExpansion(
- host, Value::CreateDoubleValue(level));
- }
- }
+ DCHECK(type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED);
+ if (host.empty())
+ return;
+
+ double level = host_zoom_map_->GetZoomLevel(host);
+ DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels);
+ DictionaryValue* host_zoom_dictionary = update.Get();
+ if (level == host_zoom_map_->GetDefaultZoomLevel()) {
+ host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL);
+ } else {
+ host_zoom_dictionary->SetWithoutPathExpansion(
+ host, Value::CreateDoubleValue(level));
}
}
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.cc ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698