OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/tab_contents_wrapper.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "chrome/browser/ui/intents/web_intent_picker_factory_impl.h" | 47 #include "chrome/browser/ui/intents/web_intent_picker_factory_impl.h" |
48 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 48 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
49 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 49 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
50 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" | 50 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" |
51 #include "chrome/common/chrome_notification_types.h" | 51 #include "chrome/common/chrome_notification_types.h" |
52 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
53 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
54 #include "chrome/common/render_messages.h" | 54 #include "chrome/common/render_messages.h" |
55 #include "content/browser/renderer_host/render_view_host.h" | 55 #include "content/browser/renderer_host/render_view_host.h" |
56 #include "content/browser/tab_contents/tab_contents_view.h" | 56 #include "content/browser/tab_contents/tab_contents_view.h" |
57 #include "content/common/notification_service.h" | 57 #include "content/public/browser/notification_service.h" |
58 #include "grit/generated_resources.h" | 58 #include "grit/generated_resources.h" |
59 #include "grit/locale_settings.h" | 59 #include "grit/locale_settings.h" |
60 #include "grit/platform_locale_settings.h" | 60 #include "grit/platform_locale_settings.h" |
61 #include "ui/base/l10n/l10n_util.h" | 61 #include "ui/base/l10n/l10n_util.h" |
62 #include "webkit/glue/webpreferences.h" | 62 #include "webkit/glue/webpreferences.h" |
63 | 63 |
64 namespace { | 64 namespace { |
65 | 65 |
66 static base::LazyInstance<PropertyAccessor<TabContentsWrapper*> > | 66 static base::LazyInstance<PropertyAccessor<TabContentsWrapper*> > |
67 g_tab_contents_wrapper_property_accessor(base::LINKER_INITIALIZED); | 67 g_tab_contents_wrapper_property_accessor(base::LINKER_INITIALIZED); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 if (switches::IsInBrowserThumbnailingEnabled()) { | 289 if (switches::IsInBrowserThumbnailingEnabled()) { |
290 thumbnail_generation_observer_.reset(new ThumbnailGenerator); | 290 thumbnail_generation_observer_.reset(new ThumbnailGenerator); |
291 thumbnail_generation_observer_->StartThumbnailing(tab_contents_.get()); | 291 thumbnail_generation_observer_->StartThumbnailing(tab_contents_.get()); |
292 } | 292 } |
293 | 293 |
294 // Set-up the showing of the omnibox search infobar if applicable. | 294 // Set-up the showing of the omnibox search infobar if applicable. |
295 if (OmniboxSearchHint::IsEnabled(profile())) | 295 if (OmniboxSearchHint::IsEnabled(profile())) |
296 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | 296 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); |
297 | 297 |
298 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED, | 298 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED, |
299 NotificationService::AllSources()); | 299 content::NotificationService::AllSources()); |
300 registrar_.Add(this, chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED, | 300 registrar_.Add(this, chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED, |
301 NotificationService::AllSources()); | 301 content::NotificationService::AllSources()); |
302 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 302 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
303 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 303 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
304 content::Source<ThemeService>( | 304 content::Source<ThemeService>( |
305 ThemeServiceFactory::GetForProfile(profile()))); | 305 ThemeServiceFactory::GetForProfile(profile()))); |
306 #endif | 306 #endif |
307 | 307 |
308 // Register for notifications about all interested prefs change. | 308 // Register for notifications about all interested prefs change. |
309 PrefService* prefs = profile()->GetPrefs(); | 309 PrefService* prefs = profile()->GetPrefs(); |
310 pref_change_registrar_.Init(prefs); | 310 pref_change_registrar_.Init(prefs); |
311 if (prefs) { | 311 if (prefs) { |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 } | 608 } |
609 default: | 609 default: |
610 NOTREACHED(); | 610 NOTREACHED(); |
611 } | 611 } |
612 } | 612 } |
613 | 613 |
614 //////////////////////////////////////////////////////////////////////////////// | 614 //////////////////////////////////////////////////////////////////////////////// |
615 // Internal helpers | 615 // Internal helpers |
616 | 616 |
617 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { | 617 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { |
618 NotificationService::current()->Notify( | 618 content::NotificationService::current()->Notify( |
619 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, | 619 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, |
620 content::Source<TabContentsWrapper>(this), | 620 content::Source<TabContentsWrapper>(this), |
621 content::Details<const SkBitmap>(&bitmap)); | 621 content::Details<const SkBitmap>(&bitmap)); |
622 } | 622 } |
623 | 623 |
624 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { | 624 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { |
625 PDFHasUnsupportedFeature(this); | 625 PDFHasUnsupportedFeature(this); |
626 } | 626 } |
627 | 627 |
628 GURL TabContentsWrapper::GetAlternateErrorPageURL() const { | 628 GURL TabContentsWrapper::GetAlternateErrorPageURL() const { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 render_view_host()->Send( | 672 render_view_host()->Send( |
673 new ChromeViewMsg_SetClientSidePhishingDetection(routing_id(), | 673 new ChromeViewMsg_SetClientSidePhishingDetection(routing_id(), |
674 safe_browsing)); | 674 safe_browsing)); |
675 #endif | 675 #endif |
676 } | 676 } |
677 | 677 |
678 void TabContentsWrapper::ExitFullscreenMode() { | 678 void TabContentsWrapper::ExitFullscreenMode() { |
679 if (tab_contents() && render_view_host()) | 679 if (tab_contents() && render_view_host()) |
680 tab_contents()->render_view_host()->ExitFullscreen(); | 680 tab_contents()->render_view_host()->ExitFullscreen(); |
681 } | 681 } |
OLD | NEW |