| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/infobars/core/infobar_delegate.h" | 5 #include "components/infobars/core/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 "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
| 10 #include "components/infobars/core/infobar_manager.h" | 10 #include "components/infobars/core/infobar_manager.h" |
| 11 #include "ui/base/resource/material_design/material_design_controller.h" | 11 #include "ui/base/resource/material_design/material_design_controller.h" |
| 12 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 13 #include "ui/gfx/vector_icons_public.h" | 13 #include "ui/gfx/vector_icons_public.h" |
| 14 | 14 |
| 15 #if !defined(OS_MACOSX) && !defined(OS_IOS) && !defined(OS_ANDROID) | 15 #if !defined(OS_MACOSX) && !defined(OS_IOS) && !defined(OS_ANDROID) |
| 16 #include "ui/gfx/color_palette.h" | 16 #include "ui/gfx/color_palette.h" |
| 17 #include "ui/gfx/paint_vector_icon.h" | 17 #include "ui/gfx/paint_vector_icon.h" |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 namespace infobars { | 20 namespace infobars { |
| 21 | 21 |
| 22 const int InfoBarDelegate::kNoIconID = 0; | 22 const int InfoBarDelegate::kNoIconID = 0; |
| 23 | 23 |
| 24 InfoBarDelegate::Detail::Detail() : icon_id(kNoIconID) { |
| 25 } |
| 26 |
| 27 InfoBarDelegate::Detail::~Detail() { |
| 28 } |
| 29 |
| 30 InfoBarDelegate::Description::Description() { |
| 31 } |
| 32 |
| 33 InfoBarDelegate::Description::~Description() { |
| 34 } |
| 35 |
| 36 InfoBarDelegate::Description::Link::Link() : start(0), end(0) { |
| 37 } |
| 38 |
| 39 InfoBarDelegate::Description::Link::~Link() { |
| 40 } |
| 41 |
| 24 InfoBarDelegate::~InfoBarDelegate() { | 42 InfoBarDelegate::~InfoBarDelegate() { |
| 25 } | 43 } |
| 26 | 44 |
| 27 InfoBarDelegate::InfoBarAutomationType | 45 InfoBarDelegate::InfoBarAutomationType |
| 28 InfoBarDelegate::GetInfoBarAutomationType() const { | 46 InfoBarDelegate::GetInfoBarAutomationType() const { |
| 29 return UNKNOWN_INFOBAR; | 47 return UNKNOWN_INFOBAR; |
| 30 } | 48 } |
| 31 | 49 |
| 32 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const { | 50 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const { |
| 33 return WARNING_TYPE; | 51 return WARNING_TYPE; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 52 : gfx::kGoogleBlue500)); | 70 : gfx::kGoogleBlue500)); |
| 53 } | 71 } |
| 54 } | 72 } |
| 55 #endif | 73 #endif |
| 56 | 74 |
| 57 int icon_id = GetIconId(); | 75 int icon_id = GetIconId(); |
| 58 return icon_id == kNoIconID ? gfx::Image() : | 76 return icon_id == kNoIconID ? gfx::Image() : |
| 59 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); | 77 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); |
| 60 } | 78 } |
| 61 | 79 |
| 80 const std::vector<InfoBarDelegate::Detail>& InfoBarDelegate::GetDetails() |
| 81 const { |
| 82 return empty_details_; |
| 83 } |
| 84 |
| 85 const std::vector<InfoBarDelegate::Description>& |
| 86 InfoBarDelegate::GetDescriptions() const { |
| 87 return empty_descriptions_; |
| 88 } |
| 89 |
| 62 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { | 90 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { |
| 63 return false; | 91 return false; |
| 64 } | 92 } |
| 65 | 93 |
| 66 bool InfoBarDelegate::ShouldExpire(const NavigationDetails& details) const { | 94 bool InfoBarDelegate::ShouldExpire(const NavigationDetails& details) const { |
| 67 return details.is_navigation_to_different_page && | 95 return details.is_navigation_to_different_page && |
| 68 !details.did_replace_entry && | 96 !details.did_replace_entry && |
| 69 // This next condition ensures a navigation that passes the above | 97 // This next condition ensures a navigation that passes the above |
| 70 // conditions doesn't dismiss infobars added while that navigation was | 98 // conditions doesn't dismiss infobars added while that navigation was |
| 71 // already in process. We carve out an exception for reloads since we | 99 // already in process. We carve out an exception for reloads since we |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 MediaThrottleInfoBarDelegate* | 163 MediaThrottleInfoBarDelegate* |
| 136 InfoBarDelegate::AsMediaThrottleInfoBarDelegate() { | 164 InfoBarDelegate::AsMediaThrottleInfoBarDelegate() { |
| 137 return nullptr; | 165 return nullptr; |
| 138 } | 166 } |
| 139 #endif | 167 #endif |
| 140 | 168 |
| 141 InfoBarDelegate::InfoBarDelegate() : nav_entry_id_(0) { | 169 InfoBarDelegate::InfoBarDelegate() : nav_entry_id_(0) { |
| 142 } | 170 } |
| 143 | 171 |
| 144 } // namespace infobars | 172 } // namespace infobars |
| OLD | NEW |