| 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/infobars/infobar_delegate.h" | 5 #include "chrome/browser/infobars/infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/infobars/infobar.h" | 9 #include "chrome/browser/infobars/infobar.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0; | 101 contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0; |
| 102 } | 102 } |
| 103 | 103 |
| 104 gfx::Image InfoBarDelegate::GetIcon() const { | 104 gfx::Image InfoBarDelegate::GetIcon() const { |
| 105 int icon_id = GetIconID(); | 105 int icon_id = GetIconID(); |
| 106 return (icon_id == kNoIconID) ? gfx::Image() : | 106 return (icon_id == kNoIconID) ? gfx::Image() : |
| 107 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); | 107 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); |
| 108 } | 108 } |
| 109 | 109 |
| 110 content::WebContents* InfoBarDelegate::web_contents() { | 110 content::WebContents* InfoBarDelegate::web_contents() { |
| 111 return (infobar_ && infobar_->owner()) ? | 111 return InfoBarService::WebContentsFromInfoBar(infobar_); |
| 112 infobar_->owner()->web_contents() : NULL; | |
| 113 } | 112 } |
| 114 | 113 |
| 115 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { | 114 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { |
| 116 } | 115 } |
| 117 | 116 |
| 118 bool InfoBarDelegate::ShouldExpireInternal( | 117 bool InfoBarDelegate::ShouldExpireInternal( |
| 119 const NavigationDetails& details) const { | 118 const NavigationDetails& details) const { |
| 120 // NOTE: If you change this, be sure to check and adjust the behavior of | 119 // NOTE: If you change this, be sure to check and adjust the behavior of |
| 121 // anyone who overrides this as necessary! | 120 // anyone who overrides this as necessary! |
| 122 return (contents_unique_id_ != details.entry_id) || details.is_reload; | 121 return (contents_unique_id_ != details.entry_id) || details.is_reload; |
| 123 } | 122 } |
| OLD | NEW |