Chromium Code Reviews| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 ThemeInstalledInfoBarDelegate* | 88 ThemeInstalledInfoBarDelegate* |
| 89 InfoBarDelegate::AsThemePreviewInfobarDelegate() { | 89 InfoBarDelegate::AsThemePreviewInfobarDelegate() { |
| 90 return NULL; | 90 return NULL; |
| 91 } | 91 } |
| 92 | 92 |
| 93 TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() { | 93 TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() { |
| 94 return NULL; | 94 return NULL; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void InfoBarDelegate::StoreActiveEntryUniqueID() { | 97 void InfoBarDelegate::StoreActiveEntryUniqueID() { |
| 98 DCHECK(web_contents()); | 98 // TODO(droger): Remove this dependency on InfoBarService, see |
| 99 // http://crbug.com/354379. | |
| 100 content::WebContents* web_contents = | |
| 101 InfoBarService::WebContentsFromInfoBar(infobar()); | |
|
blundell
2014/04/09 12:35:12
How much larger would it make this CL to change th
droger
2014/04/09 12:44:06
Not very large, but it will touch more files (Info
droger
2014/04/09 13:22:54
This looks like this:
https://codereview.chromium.
| |
| 102 DCHECK(web_contents); | |
| 99 NavigationEntry* active_entry = | 103 NavigationEntry* active_entry = |
| 100 web_contents()->GetController().GetActiveEntry(); | 104 web_contents->GetController().GetActiveEntry(); |
| 101 contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0; | 105 contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0; |
| 102 } | 106 } |
| 103 | 107 |
| 104 gfx::Image InfoBarDelegate::GetIcon() const { | 108 gfx::Image InfoBarDelegate::GetIcon() const { |
| 105 int icon_id = GetIconID(); | 109 int icon_id = GetIconID(); |
| 106 return (icon_id == kNoIconID) ? gfx::Image() : | 110 return (icon_id == kNoIconID) ? gfx::Image() : |
| 107 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); | 111 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); |
| 108 } | 112 } |
| 109 | 113 |
| 110 content::WebContents* InfoBarDelegate::web_contents() { | |
| 111 return InfoBarService::WebContentsFromInfoBar(infobar_); | |
| 112 } | |
| 113 | |
| 114 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { | 114 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool InfoBarDelegate::ShouldExpireInternal( | 117 bool InfoBarDelegate::ShouldExpireInternal( |
| 118 const NavigationDetails& details) const { | 118 const NavigationDetails& details) const { |
| 119 // 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 |
| 120 // anyone who overrides this as necessary! | 120 // anyone who overrides this as necessary! |
| 121 return (contents_unique_id_ != details.entry_id) || details.is_reload; | 121 return (contents_unique_id_ != details.entry_id) || details.is_reload; |
| 122 } | 122 } |
| OLD | NEW |