OLD | NEW |
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/pdf/pdf_unsupported_feature.h" | 5 #include "chrome/browser/ui/pdf/pdf_unsupported_feature.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
11 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 11 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
12 #include "chrome/browser/plugins/plugin_metadata.h" | 12 #include "chrome/browser/plugins/plugin_metadata.h" |
13 #include "chrome/browser/plugins/plugin_prefs.h" | 13 #include "chrome/browser/plugins/plugin_prefs.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/renderer_preferences_util.h" | 15 #include "chrome/browser/renderer_preferences_util.h" |
16 #include "chrome/browser/tab_contents/tab_util.h" | 16 #include "chrome/browser/tab_contents/tab_util.h" |
17 #include "chrome/common/chrome_content_client.h" | 17 #include "chrome/common/chrome_content_client.h" |
18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
19 #include "components/pdf/browser/open_pdf_in_reader_prompt_client.h" | 19 #include "components/pdf/browser/open_pdf_in_reader_prompt_client.h" |
20 #include "components/pdf/browser/pdf_web_contents_helper.h" | 20 #include "components/pdf/browser/pdf_web_contents_helper.h" |
| 21 #include "content/public/browser/host_zoom_map.h" |
21 #include "content/public/browser/interstitial_page.h" | 22 #include "content/public/browser/interstitial_page.h" |
22 #include "content/public/browser/interstitial_page_delegate.h" | 23 #include "content/public/browser/interstitial_page_delegate.h" |
23 #include "content/public/browser/navigation_details.h" | 24 #include "content/public/browser/navigation_details.h" |
24 #include "content/public/browser/navigation_entry.h" | 25 #include "content/public/browser/navigation_entry.h" |
25 #include "content/public/browser/page_navigator.h" | 26 #include "content/public/browser/page_navigator.h" |
26 #include "content/public/browser/render_frame_host.h" | 27 #include "content/public/browser/render_frame_host.h" |
27 #include "content/public/browser/render_process_host.h" | 28 #include "content/public/browser/render_process_host.h" |
28 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
29 #include "content/public/browser/user_metrics.h" | 30 #include "content/public/browser/user_metrics.h" |
30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 32 #include "content/public/common/renderer_preferences.h" |
31 #include "grit/browser_resources.h" | 33 #include "grit/browser_resources.h" |
32 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
33 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
34 #include "ui/base/webui/jstemplate_builder.h" | 36 #include "ui/base/webui/jstemplate_builder.h" |
35 | 37 |
36 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
37 #include "base/win/metro.h" | 39 #include "base/win/metro.h" |
38 #include "chrome/browser/ui/pdf/adobe_reader_info_win.h" | 40 #include "chrome/browser/ui/pdf/adobe_reader_info_win.h" |
39 #endif | 41 #endif |
40 | 42 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 NOTREACHED(); | 214 NOTREACHED(); |
213 } | 215 } |
214 interstitial_page_->Proceed(); | 216 interstitial_page_->Proceed(); |
215 } | 217 } |
216 | 218 |
217 virtual void OverrideRendererPrefs( | 219 virtual void OverrideRendererPrefs( |
218 content::RendererPreferences* prefs) OVERRIDE { | 220 content::RendererPreferences* prefs) OVERRIDE { |
219 Profile* profile = | 221 Profile* profile = |
220 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 222 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
221 renderer_preferences_util::UpdateFromSystemSettings(prefs, profile); | 223 renderer_preferences_util::UpdateFromSystemSettings(prefs, profile); |
| 224 // TODO(wjmaclean): Convert this to use the HostZoomMap for the WebContents |
| 225 // when HostZoomMap moves to StoragePartition. |
| 226 prefs->default_zoom_level = |
| 227 content::HostZoomMap::GetDefaultForBrowserContext(profile) |
| 228 ->GetDefaultZoomLevel(); |
222 } | 229 } |
223 | 230 |
224 private: | 231 private: |
225 WebContents* web_contents_; | 232 WebContents* web_contents_; |
226 WebPluginInfo reader_webplugininfo_; | 233 WebPluginInfo reader_webplugininfo_; |
227 InterstitialPage* interstitial_page_; // Owns us. | 234 InterstitialPage* interstitial_page_; // Owns us. |
228 | 235 |
229 DISALLOW_COPY_AND_ASSIGN(PDFUnsupportedFeatureInterstitial); | 236 DISALLOW_COPY_AND_ASSIGN(PDFUnsupportedFeatureInterstitial); |
230 }; | 237 }; |
231 | 238 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); | 365 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); |
359 return; | 366 return; |
360 } | 367 } |
361 GetAdobeReaderPluginInfoAsync( | 368 GetAdobeReaderPluginInfoAsync( |
362 profile, | 369 profile, |
363 base::Bind(&GotPluginsCallback, | 370 base::Bind(&GotPluginsCallback, |
364 web_contents->GetRenderProcessHost()->GetID(), | 371 web_contents->GetRenderProcessHost()->GetID(), |
365 web_contents->GetRenderViewHost()->GetRoutingID())); | 372 web_contents->GetRenderViewHost()->GetRoutingID())); |
366 #endif // defined(OS_WIN) | 373 #endif // defined(OS_WIN) |
367 } | 374 } |
OLD | NEW |