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

Side by Side Diff: chrome/browser/ui/pdf/pdf_unsupported_feature.cc

Issue 627043002: replace OVERRIDE and FINAL with override and final in chrome/browser/ui/[a-s]* (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 "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"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 // The prompt delegate used to ask the user if they want to use Adobe Reader 53 // The prompt delegate used to ask the user if they want to use Adobe Reader
54 // by default. 54 // by default.
55 class PDFEnableAdobeReaderPromptClient 55 class PDFEnableAdobeReaderPromptClient
56 : public pdf::OpenPDFInReaderPromptClient { 56 : public pdf::OpenPDFInReaderPromptClient {
57 public: 57 public:
58 explicit PDFEnableAdobeReaderPromptClient(Profile* profile); 58 explicit PDFEnableAdobeReaderPromptClient(Profile* profile);
59 virtual ~PDFEnableAdobeReaderPromptClient(); 59 virtual ~PDFEnableAdobeReaderPromptClient();
60 60
61 // pdf::OpenPDFInReaderPromptClient 61 // pdf::OpenPDFInReaderPromptClient
62 virtual base::string16 GetMessageText() const OVERRIDE; 62 virtual base::string16 GetMessageText() const override;
63 virtual base::string16 GetAcceptButtonText() const OVERRIDE; 63 virtual base::string16 GetAcceptButtonText() const override;
64 virtual base::string16 GetCancelButtonText() const OVERRIDE; 64 virtual base::string16 GetCancelButtonText() const override;
65 virtual bool ShouldExpire( 65 virtual bool ShouldExpire(
66 const content::LoadCommittedDetails& details) const OVERRIDE; 66 const content::LoadCommittedDetails& details) const override;
67 virtual void Accept() OVERRIDE; 67 virtual void Accept() override;
68 virtual void Cancel() OVERRIDE; 68 virtual void Cancel() override;
69 69
70 private: 70 private:
71 void OnYes(); 71 void OnYes();
72 void OnNo(); 72 void OnNo();
73 73
74 Profile* profile_; 74 Profile* profile_;
75 75
76 DISALLOW_IMPLICIT_CONSTRUCTORS(PDFEnableAdobeReaderPromptClient); 76 DISALLOW_IMPLICIT_CONSTRUCTORS(PDFEnableAdobeReaderPromptClient);
77 }; 77 };
78 78
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 : web_contents_(web_contents), 155 : web_contents_(web_contents),
156 reader_webplugininfo_(reader_webplugininfo) { 156 reader_webplugininfo_(reader_webplugininfo) {
157 content::RecordAction(UserMetricsAction("PDF_ReaderInterstitialShown")); 157 content::RecordAction(UserMetricsAction("PDF_ReaderInterstitialShown"));
158 interstitial_page_ = InterstitialPage::Create( 158 interstitial_page_ = InterstitialPage::Create(
159 web_contents, false, web_contents->GetURL(), this); 159 web_contents, false, web_contents->GetURL(), this);
160 interstitial_page_->Show(); 160 interstitial_page_->Show();
161 } 161 }
162 162
163 protected: 163 protected:
164 // InterstitialPageDelegate implementation. 164 // InterstitialPageDelegate implementation.
165 virtual std::string GetHTMLContents() OVERRIDE { 165 virtual std::string GetHTMLContents() override {
166 base::DictionaryValue strings; 166 base::DictionaryValue strings;
167 strings.SetString( 167 strings.SetString(
168 "title", 168 "title",
169 l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_TITLE)); 169 l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_TITLE));
170 strings.SetString( 170 strings.SetString(
171 "headLine", 171 "headLine",
172 l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_BODY)); 172 l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_BODY));
173 strings.SetString( 173 strings.SetString(
174 "update", 174 "update",
175 l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_UPDATE)); 175 l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_UPDATE));
176 strings.SetString( 176 strings.SetString(
177 "open_with_reader", 177 "open_with_reader",
178 l10n_util::GetStringUTF16( 178 l10n_util::GetStringUTF16(
179 IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_PROCEED)); 179 IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_PROCEED));
180 strings.SetString( 180 strings.SetString(
181 "ok", 181 "ok",
182 l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_OK)); 182 l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_OK));
183 strings.SetString( 183 strings.SetString(
184 "cancel", 184 "cancel",
185 l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_CANCEL)); 185 l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_CANCEL));
186 186
187 base::StringPiece html(ResourceBundle::GetSharedInstance(). 187 base::StringPiece html(ResourceBundle::GetSharedInstance().
188 GetRawDataResource(IDR_READER_OUT_OF_DATE_HTML)); 188 GetRawDataResource(IDR_READER_OUT_OF_DATE_HTML));
189 189
190 return webui::GetI18nTemplateHtml(html, &strings); 190 return webui::GetI18nTemplateHtml(html, &strings);
191 } 191 }
192 192
193 virtual void CommandReceived(const std::string& command) OVERRIDE { 193 virtual void CommandReceived(const std::string& command) override {
194 if (command == "0") { 194 if (command == "0") {
195 content::RecordAction( 195 content::RecordAction(
196 UserMetricsAction("PDF_ReaderInterstitialCancel")); 196 UserMetricsAction("PDF_ReaderInterstitialCancel"));
197 interstitial_page_->DontProceed(); 197 interstitial_page_->DontProceed();
198 return; 198 return;
199 } 199 }
200 200
201 if (command == "1") { 201 if (command == "1") {
202 content::RecordAction( 202 content::RecordAction(
203 UserMetricsAction("PDF_ReaderInterstitialUpdate")); 203 UserMetricsAction("PDF_ReaderInterstitialUpdate"));
204 OpenReaderUpdateURL(web_contents_); 204 OpenReaderUpdateURL(web_contents_);
205 } else if (command == "2") { 205 } else if (command == "2") {
206 content::RecordAction( 206 content::RecordAction(
207 UserMetricsAction("PDF_ReaderInterstitialIgnore")); 207 UserMetricsAction("PDF_ReaderInterstitialIgnore"));
208 // Pretend that the plug-in is up-to-date so that we don't block it. 208 // Pretend that the plug-in is up-to-date so that we don't block it.
209 reader_webplugininfo_.version = base::ASCIIToUTF16("11.0.0.0"); 209 reader_webplugininfo_.version = base::ASCIIToUTF16("11.0.0.0");
210 OpenUsingReader(web_contents_, reader_webplugininfo_, NULL); 210 OpenUsingReader(web_contents_, reader_webplugininfo_, NULL);
211 } else { 211 } else {
212 NOTREACHED(); 212 NOTREACHED();
213 } 213 }
214 interstitial_page_->Proceed(); 214 interstitial_page_->Proceed();
215 } 215 }
216 216
217 virtual void OverrideRendererPrefs( 217 virtual void OverrideRendererPrefs(
218 content::RendererPreferences* prefs) OVERRIDE { 218 content::RendererPreferences* prefs) override {
219 Profile* profile = 219 Profile* profile =
220 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); 220 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
221 renderer_preferences_util::UpdateFromSystemSettings(prefs, profile); 221 renderer_preferences_util::UpdateFromSystemSettings(prefs, profile);
222 } 222 }
223 223
224 private: 224 private:
225 WebContents* web_contents_; 225 WebContents* web_contents_;
226 WebPluginInfo reader_webplugininfo_; 226 WebPluginInfo reader_webplugininfo_;
227 InterstitialPage* interstitial_page_; // Owns us. 227 InterstitialPage* interstitial_page_; // Owns us.
228 228
229 DISALLOW_COPY_AND_ASSIGN(PDFUnsupportedFeatureInterstitial); 229 DISALLOW_COPY_AND_ASSIGN(PDFUnsupportedFeatureInterstitial);
230 }; 230 };
231 231
232 // The delegate for the bubble used to inform the user that we don't support a 232 // The delegate for the bubble used to inform the user that we don't support a
233 // feature in the PDF. 233 // feature in the PDF.
234 class PDFUnsupportedFeaturePromptClient 234 class PDFUnsupportedFeaturePromptClient
235 : public pdf::OpenPDFInReaderPromptClient { 235 : public pdf::OpenPDFInReaderPromptClient {
236 public: 236 public:
237 PDFUnsupportedFeaturePromptClient(WebContents* web_contents, 237 PDFUnsupportedFeaturePromptClient(WebContents* web_contents,
238 const AdobeReaderPluginInfo& reader_info); 238 const AdobeReaderPluginInfo& reader_info);
239 virtual ~PDFUnsupportedFeaturePromptClient(); 239 virtual ~PDFUnsupportedFeaturePromptClient();
240 240
241 // pdf::OpenPDFInReaderPromptClient: 241 // pdf::OpenPDFInReaderPromptClient:
242 virtual base::string16 GetMessageText() const OVERRIDE; 242 virtual base::string16 GetMessageText() const override;
243 virtual base::string16 GetAcceptButtonText() const OVERRIDE; 243 virtual base::string16 GetAcceptButtonText() const override;
244 virtual base::string16 GetCancelButtonText() const OVERRIDE; 244 virtual base::string16 GetCancelButtonText() const override;
245 virtual bool ShouldExpire( 245 virtual bool ShouldExpire(
246 const content::LoadCommittedDetails& details) const OVERRIDE; 246 const content::LoadCommittedDetails& details) const override;
247 virtual void Accept() OVERRIDE; 247 virtual void Accept() override;
248 virtual void Cancel() OVERRIDE; 248 virtual void Cancel() override;
249 249
250 private: 250 private:
251 WebContents* web_contents_; 251 WebContents* web_contents_;
252 const AdobeReaderPluginInfo reader_info_; 252 const AdobeReaderPluginInfo reader_info_;
253 253
254 DISALLOW_IMPLICIT_CONSTRUCTORS(PDFUnsupportedFeaturePromptClient); 254 DISALLOW_IMPLICIT_CONSTRUCTORS(PDFUnsupportedFeaturePromptClient);
255 }; 255 };
256 256
257 PDFUnsupportedFeaturePromptClient::PDFUnsupportedFeaturePromptClient( 257 PDFUnsupportedFeaturePromptClient::PDFUnsupportedFeaturePromptClient(
258 WebContents* web_contents, 258 WebContents* web_contents,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info); 358 MaybeShowOpenPDFInReaderPrompt(web_contents, reader_info);
359 return; 359 return;
360 } 360 }
361 GetAdobeReaderPluginInfoAsync( 361 GetAdobeReaderPluginInfoAsync(
362 profile, 362 profile,
363 base::Bind(&GotPluginsCallback, 363 base::Bind(&GotPluginsCallback,
364 web_contents->GetRenderProcessHost()->GetID(), 364 web_contents->GetRenderProcessHost()->GetID(),
365 web_contents->GetRenderViewHost()->GetRoutingID())); 365 web_contents->GetRenderViewHost()->GetRoutingID()));
366 #endif // defined(OS_WIN) 366 #endif // defined(OS_WIN)
367 } 367 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/pdf/pdf_browsertest_base.h ('k') | chrome/browser/ui/prefs/prefs_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698