OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include <blimp/engine/app/settings_manager.h> | |
6 #include "content/public/browser/render_view_host.h" | |
7 #include "content/public/common/web_preferences.h" | |
8 | |
9 namespace blimp { | |
10 namespace engine { | |
11 | |
12 SettingsManager::SettingsManager() {} | |
13 | |
14 SettingsManager::~SettingsManager() {} | |
15 | |
16 void SettingsManager::AddObserver(Observer* observer) { | |
17 observer_list_.AddObserver(observer); | |
18 } | |
19 | |
20 void SettingsManager::RemoveObserver(Observer* observer) { | |
21 observer_list_.RemoveObserver(observer); | |
22 } | |
23 | |
24 void SettingsManager::UpdateWebkitPreferences(content::WebPreferences* prefs) { | |
25 prefs->record_whole_document = settings_.record_whole_document; | |
26 prefs->animation_policy = settings_.animation_policy; | |
27 prefs->viewport_meta_enabled = settings_.viewport_meta_enabled; | |
28 prefs->default_minimum_page_scale_factor = | |
29 settings_.default_minimum_page_scale_factor; | |
30 prefs->default_maximum_page_scale_factor = | |
31 settings_.default_maximum_page_scale_factor; | |
32 prefs->shrinks_viewport_contents_to_fit = | |
33 settings_.shrinks_viewport_contents_to_fit; | |
34 prefs->use_solid_color_scrollbars = true; | |
35 } | |
36 | |
37 const EngineSettings& SettingsManager::GetEngineSettings() const { | |
38 return settings_; | |
39 } | |
40 | |
41 void SettingsManager::UpdateEngineSettings(const EngineSettings& settings) { | |
42 EngineSettings old_settings = settings_; | |
43 settings_ = settings; | |
44 | |
45 if (settings_.record_whole_document != old_settings.record_whole_document) { | |
46 // Notify the observers that the web preferences have changed. | |
47 for (auto& observer : observer_list_) | |
48 observer.OnWebPreferencesChanged(); | |
49 } | |
50 } | |
51 | |
52 } // namespace engine | |
53 } // namespace blimp | |
OLD | NEW |