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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/chrome_notification_types.h" 6 #include "chrome/browser/chrome_notification_types.h"
7 #include "chrome/browser/content_settings/host_content_settings_map.h" 7 #include "chrome/browser/content_settings/host_content_settings_map.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/prerender/prerender_manager.h" 9 #include "chrome/browser/prerender/prerender_manager.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 12 matching lines...) Expand all
23 // Forward all NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED to the specified 23 // Forward all NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED to the specified
24 // ContentSettingImageModel. 24 // ContentSettingImageModel.
25 class NotificationForwarder : public content::NotificationObserver { 25 class NotificationForwarder : public content::NotificationObserver {
26 public: 26 public:
27 explicit NotificationForwarder(ContentSettingImageModel* model) 27 explicit NotificationForwarder(ContentSettingImageModel* model)
28 : model_(model) { 28 : model_(model) {
29 registrar_.Add(this, 29 registrar_.Add(this,
30 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 30 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
31 content::NotificationService::AllSources()); 31 content::NotificationService::AllSources());
32 } 32 }
33 virtual ~NotificationForwarder() {} 33 ~NotificationForwarder() override {}
34 34
35 void clear() { 35 void clear() {
36 registrar_.RemoveAll(); 36 registrar_.RemoveAll();
37 } 37 }
38 38
39 virtual void Observe(int type, 39 void Observe(int type,
40 const content::NotificationSource& source, 40 const content::NotificationSource& source,
41 const content::NotificationDetails& details) override { 41 const content::NotificationDetails& details) override {
42 if (type == chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED) { 42 if (type == chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED) {
43 model_->UpdateFromWebContents( 43 model_->UpdateFromWebContents(
44 content::Source<content::WebContents>(source).ptr()); 44 content::Source<content::WebContents>(source).ptr());
45 } 45 }
46 } 46 }
47 47
48 private: 48 private:
49 content::NotificationRegistrar registrar_; 49 content::NotificationRegistrar registrar_;
50 ContentSettingImageModel* model_; 50 ContentSettingImageModel* model_;
51 51
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 scoped_ptr<ContentSettingImageModel> content_setting_image_model( 121 scoped_ptr<ContentSettingImageModel> content_setting_image_model(
122 ContentSettingImageModel::CreateContentSettingImageModel( 122 ContentSettingImageModel::CreateContentSettingImageModel(
123 CONTENT_SETTINGS_TYPE_IMAGES)); 123 CONTENT_SETTINGS_TYPE_IMAGES));
124 NotificationForwarder forwarder(content_setting_image_model.get()); 124 NotificationForwarder forwarder(content_setting_image_model.get());
125 // Should not crash. 125 // Should not crash.
126 TabSpecificContentSettings::CreateForWebContents(web_contents()); 126 TabSpecificContentSettings::CreateForWebContents(web_contents());
127 forwarder.clear(); 127 forwarder.clear();
128 } 128 }
129 129
130 } // namespace 130 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698