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

Side by Side Diff: chrome/browser/ui/prefs/prefs_tab_helper.cc

Issue 2874833002: Don't compile code for desktop zoom or GuestViews on mobile platforms. (Closed)
Patch Set: Rebase. Created 3 years, 7 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 "chrome/browser/ui/prefs/prefs_tab_helper.h" 5 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/chrome_notification_types.h" 23 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/profiles/incognito_helpers.h" 24 #include "chrome/browser/profiles/incognito_helpers.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/renderer_preferences_util.h" 26 #include "chrome/browser/renderer_preferences_util.h"
27 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
28 #include "chrome/common/pref_font_webkit_names.h" 27 #include "chrome/common/pref_font_webkit_names.h"
29 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
30 #include "chrome/common/pref_names_util.h" 29 #include "chrome/common/pref_names_util.h"
31 #include "chrome/grit/locale_settings.h" 30 #include "chrome/grit/locale_settings.h"
32 #include "chrome/grit/platform_locale_settings.h" 31 #include "chrome/grit/platform_locale_settings.h"
33 #include "components/keyed_service/content/browser_context_dependency_manager.h" 32 #include "components/keyed_service/content/browser_context_dependency_manager.h"
34 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" 33 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
35 #include "components/keyed_service/core/keyed_service.h" 34 #include "components/keyed_service/core/keyed_service.h"
36 #include "components/pref_registry/pref_registry_syncable.h" 35 #include "components/pref_registry/pref_registry_syncable.h"
37 #include "components/prefs/overlay_user_pref_store.h" 36 #include "components/prefs/overlay_user_pref_store.h"
38 #include "components/prefs/pref_change_registrar.h" 37 #include "components/prefs/pref_change_registrar.h"
39 #include "components/prefs/pref_service.h" 38 #include "components/prefs/pref_service.h"
40 #include "components/proxy_config/proxy_config_pref_names.h" 39 #include "components/proxy_config/proxy_config_pref_names.h"
41 #include "components/strings/grit/components_locale_settings.h" 40 #include "components/strings/grit/components_locale_settings.h"
42 #include "content/public/browser/notification_details.h" 41 #include "content/public/browser/notification_details.h"
43 #include "content/public/browser/notification_service.h" 42 #include "content/public/browser/notification_service.h"
44 #include "content/public/browser/render_view_host.h" 43 #include "content/public/browser/render_view_host.h"
45 #include "content/public/browser/web_contents.h" 44 #include "content/public/browser/web_contents.h"
46 #include "content/public/common/renderer_preferences.h" 45 #include "content/public/common/renderer_preferences.h"
47 #include "content/public/common/web_preferences.h" 46 #include "content/public/common/web_preferences.h"
48 #include "extensions/features/features.h" 47 #include "extensions/features/features.h"
49 #include "media/media_features.h" 48 #include "media/media_features.h"
50 #include "third_party/icu/source/common/unicode/uchar.h" 49 #include "third_party/icu/source/common/unicode/uchar.h"
51 #include "third_party/icu/source/common/unicode/uscript.h" 50 #include "third_party/icu/source/common/unicode/uscript.h"
52 #include "ui/base/l10n/l10n_util.h" 51 #include "ui/base/l10n/l10n_util.h"
53 52
53 #if !defined(OS_ANDROID)
54 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
55 #endif
56
54 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 57 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
55 #include "chrome/browser/themes/theme_service.h" 58 #include "chrome/browser/themes/theme_service.h"
56 #include "chrome/browser/themes/theme_service_factory.h" 59 #include "chrome/browser/themes/theme_service_factory.h"
57 #endif 60 #endif
58 61
59 #if defined(OS_WIN) 62 #if defined(OS_WIN)
60 #include "base/win/windows_version.h" 63 #include "base/win/windows_version.h"
61 #endif 64 #endif
62 65
63 using content::WebContents; 66 using content::WebContents;
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 PrefWatcher* PrefWatcher::Get(Profile* profile) { 469 PrefWatcher* PrefWatcher::Get(Profile* profile) {
467 return PrefWatcherFactory::GetForProfile(profile); 470 return PrefWatcherFactory::GetForProfile(profile);
468 } 471 }
469 472
470 PrefsTabHelper::PrefsTabHelper(WebContents* contents) 473 PrefsTabHelper::PrefsTabHelper(WebContents* contents)
471 : web_contents_(contents), 474 : web_contents_(contents),
472 profile_(Profile::FromBrowserContext(web_contents_->GetBrowserContext())), 475 profile_(Profile::FromBrowserContext(web_contents_->GetBrowserContext())),
473 weak_ptr_factory_(this) { 476 weak_ptr_factory_(this) {
474 PrefService* prefs = profile_->GetPrefs(); 477 PrefService* prefs = profile_->GetPrefs();
475 if (prefs) { 478 if (prefs) {
479 #if !defined(OS_ANDROID)
476 // If the tab is in an incognito profile, we track changes in the default 480 // If the tab is in an incognito profile, we track changes in the default
477 // zoom level of the parent profile instead. 481 // zoom level of the parent profile instead.
478 Profile* profile_to_track = profile_->GetOriginalProfile(); 482 Profile* profile_to_track = profile_->GetOriginalProfile();
479 ChromeZoomLevelPrefs* zoom_level_prefs = 483 ChromeZoomLevelPrefs* zoom_level_prefs =
480 profile_to_track->GetZoomLevelPrefs(); 484 profile_to_track->GetZoomLevelPrefs();
481 485
482 base::Closure renderer_callback = base::Bind( 486 base::Closure renderer_callback = base::Bind(
483 &PrefsTabHelper::UpdateRendererPreferences, base::Unretained(this)); 487 &PrefsTabHelper::UpdateRendererPreferences, base::Unretained(this));
484 // Tests should not need to create a ZoomLevelPrefs. 488 // Tests should not need to create a ZoomLevelPrefs.
485 if (zoom_level_prefs) { 489 if (zoom_level_prefs) {
486 default_zoom_level_subscription_ = 490 default_zoom_level_subscription_ =
487 zoom_level_prefs->RegisterDefaultZoomLevelCallback(renderer_callback); 491 zoom_level_prefs->RegisterDefaultZoomLevelCallback(renderer_callback);
488 } 492 }
493 #endif // !defined(OS_ANDROID)
489 494
490 PrefWatcher::Get(profile_)->RegisterHelper(this); 495 PrefWatcher::Get(profile_)->RegisterHelper(this);
491 } 496 }
492 497
493 content::RendererPreferences* render_prefs = 498 content::RendererPreferences* render_prefs =
494 web_contents_->GetMutableRendererPrefs(); 499 web_contents_->GetMutableRendererPrefs();
495 renderer_preferences_util::UpdateFromSystemSettings(render_prefs, 500 renderer_preferences_util::UpdateFromSystemSettings(render_prefs,
496 profile_, 501 profile_,
497 web_contents_); 502 web_contents_);
498 503
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 } 686 }
682 687
683 void PrefsTabHelper::NotifyWebkitPreferencesChanged( 688 void PrefsTabHelper::NotifyWebkitPreferencesChanged(
684 const std::string& pref_name) { 689 const std::string& pref_name) {
685 #if !defined(OS_ANDROID) 690 #if !defined(OS_ANDROID)
686 OnFontFamilyPrefChanged(pref_name); 691 OnFontFamilyPrefChanged(pref_name);
687 #endif 692 #endif
688 693
689 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); 694 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged();
690 } 695 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/prefs/prefs_tab_helper.h ('k') | chrome/browser/ui/tab_contents/core_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698