| 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 const string16& name, | 257 const string16& name, |
| 258 const GURL& update_url); | 258 const GURL& update_url); |
| 259 | 259 |
| 260 private: | 260 private: |
| 261 virtual ~OutdatedPluginInfoBar(); | 261 virtual ~OutdatedPluginInfoBar(); |
| 262 | 262 |
| 263 // ConfirmInfoBarDelegate: | 263 // ConfirmInfoBarDelegate: |
| 264 virtual void InfoBarClosed(); | 264 virtual void InfoBarClosed(); |
| 265 virtual SkBitmap* GetIcon() const; | 265 virtual SkBitmap* GetIcon() const; |
| 266 virtual string16 GetMessageText() const; | 266 virtual string16 GetMessageText() const; |
| 267 virtual int GetButtons() const; | |
| 268 virtual string16 GetButtonLabel(InfoBarButton button) const; | 267 virtual string16 GetButtonLabel(InfoBarButton button) const; |
| 269 virtual bool Accept(); | 268 virtual bool Accept(); |
| 270 virtual bool Cancel(); | 269 virtual bool Cancel(); |
| 271 virtual string16 GetLinkText(); | 270 virtual string16 GetLinkText(); |
| 272 virtual bool LinkClicked(WindowOpenDisposition disposition); | 271 virtual bool LinkClicked(WindowOpenDisposition disposition); |
| 273 | 272 |
| 274 TabContents* tab_contents_; | 273 TabContents* tab_contents_; |
| 275 string16 name_; | 274 string16 name_; |
| 276 GURL update_url_; | 275 GURL update_url_; |
| 277 }; | 276 }; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 297 | 296 |
| 298 SkBitmap* OutdatedPluginInfoBar::GetIcon() const { | 297 SkBitmap* OutdatedPluginInfoBar::GetIcon() const { |
| 299 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | 298 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 300 IDR_INFOBAR_PLUGIN_INSTALL); | 299 IDR_INFOBAR_PLUGIN_INSTALL); |
| 301 } | 300 } |
| 302 | 301 |
| 303 string16 OutdatedPluginInfoBar::GetMessageText() const { | 302 string16 OutdatedPluginInfoBar::GetMessageText() const { |
| 304 return l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED_PROMPT, name_); | 303 return l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED_PROMPT, name_); |
| 305 } | 304 } |
| 306 | 305 |
| 307 int OutdatedPluginInfoBar::GetButtons() const { | |
| 308 return BUTTON_OK | BUTTON_CANCEL; | |
| 309 } | |
| 310 | |
| 311 string16 OutdatedPluginInfoBar::GetButtonLabel(InfoBarButton button) const { | 306 string16 OutdatedPluginInfoBar::GetButtonLabel(InfoBarButton button) const { |
| 312 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 307 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| 313 IDS_PLUGIN_UPDATE : IDS_PLUGIN_ENABLE_TEMPORARILY); | 308 IDS_PLUGIN_UPDATE : IDS_PLUGIN_ENABLE_TEMPORARILY); |
| 314 } | 309 } |
| 315 | 310 |
| 316 bool OutdatedPluginInfoBar::Accept() { | 311 bool OutdatedPluginInfoBar::Accept() { |
| 317 UserMetrics::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); | 312 UserMetrics::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); |
| 318 tab_contents_->OpenURL(update_url_, GURL(), NEW_FOREGROUND_TAB, | 313 tab_contents_->OpenURL(update_url_, GURL(), NEW_FOREGROUND_TAB, |
| 319 PageTransition::LINK); | 314 PageTransition::LINK); |
| 320 return false; | 315 return false; |
| (...skipping 3074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3395 if (pm != NULL) { | 3390 if (pm != NULL) { |
| 3396 if (pm->MaybeUsePreloadedPage(this, url)) { | 3391 if (pm->MaybeUsePreloadedPage(this, url)) { |
| 3397 // TODO(tburkard): If the preloaded page has not finished preloading | 3392 // TODO(tburkard): If the preloaded page has not finished preloading |
| 3398 // yet, we should not do this. | 3393 // yet, we should not do this. |
| 3399 DidStopLoading(); | 3394 DidStopLoading(); |
| 3400 return true; | 3395 return true; |
| 3401 } | 3396 } |
| 3402 } | 3397 } |
| 3403 return false; | 3398 return false; |
| 3404 } | 3399 } |
| OLD | NEW |