| 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 "ios/chrome/browser/infobars/infobar_manager_impl.h" | 5 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "components/autofill/core/browser/autofill_cc_infobar_delegate.h" |
| 7 #include "components/infobars/core/confirm_infobar_delegate.h" | 10 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 8 #include "components/infobars/core/infobar.h" | 11 #include "components/infobars/core/infobar.h" |
| 9 #include "components/infobars/core/infobar_delegate.h" | 12 #include "components/infobars/core/infobar_delegate.h" |
| 10 #include "ios/chrome/browser/infobars/infobar_utils.h" | 13 #include "ios/chrome/browser/infobars/infobar_utils.h" |
| 11 #include "ios/web/public/load_committed_details.h" | 14 #include "ios/web/public/load_committed_details.h" |
| 12 #include "ios/web/public/navigation_item.h" | 15 #include "ios/web/public/navigation_item.h" |
| 13 #include "ios/web/public/navigation_manager.h" | 16 #include "ios/web/public/navigation_manager.h" |
| 14 #include "ios/web/public/web_state/web_state.h" | 17 #include "ios/web/public/web_state/web_state.h" |
| 15 #include "ui/base/page_transition_types.h" | 18 #include "ui/base/page_transition_types.h" |
| 16 | 19 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 58 } |
| 56 | 59 |
| 57 int InfoBarManagerImpl::GetActiveEntryID() { | 60 int InfoBarManagerImpl::GetActiveEntryID() { |
| 58 web::NavigationItem* visible_item = | 61 web::NavigationItem* visible_item = |
| 59 web_state()->GetNavigationManager()->GetVisibleItem(); | 62 web_state()->GetNavigationManager()->GetVisibleItem(); |
| 60 return visible_item ? visible_item->GetUniqueID() : 0; | 63 return visible_item ? visible_item->GetUniqueID() : 0; |
| 61 } | 64 } |
| 62 | 65 |
| 63 scoped_ptr<infobars::InfoBar> InfoBarManagerImpl::CreateConfirmInfoBar( | 66 scoped_ptr<infobars::InfoBar> InfoBarManagerImpl::CreateConfirmInfoBar( |
| 64 scoped_ptr<ConfirmInfoBarDelegate> delegate) { | 67 scoped_ptr<ConfirmInfoBarDelegate> delegate) { |
| 65 return ::CreateConfirmInfoBar(delegate.Pass()); | 68 return ::CreateConfirmInfoBar(std::move(delegate)); |
| 69 } |
| 70 |
| 71 scoped_ptr<infobars::InfoBar> InfoBarManagerImpl::CreateAutofillCCInfoBar( |
| 72 scoped_ptr<autofill::AutofillCCInfoBarDelegate> delegate) { |
| 73 return ::CreateConfirmInfoBar(std::move(delegate)); |
| 66 } | 74 } |
| 67 | 75 |
| 68 void InfoBarManagerImpl::NavigationItemCommitted( | 76 void InfoBarManagerImpl::NavigationItemCommitted( |
| 69 const web::LoadCommittedDetails& load_details) { | 77 const web::LoadCommittedDetails& load_details) { |
| 70 OnNavigation(NavigationDetailsFromLoadCommittedDetails(load_details)); | 78 OnNavigation(NavigationDetailsFromLoadCommittedDetails(load_details)); |
| 71 } | 79 } |
| 72 | 80 |
| 73 void InfoBarManagerImpl::WebStateDestroyed() { | 81 void InfoBarManagerImpl::WebStateDestroyed() { |
| 74 // The WebState is going away; be aggressively paranoid and delete this | 82 // The WebState is going away; be aggressively paranoid and delete this |
| 75 // InfoBarManagerImpl lest other parts of the system attempt to add infobars | 83 // InfoBarManagerImpl lest other parts of the system attempt to add infobars |
| 76 // or use it otherwise during the destruction. | 84 // or use it otherwise during the destruction. |
| 77 web_state()->RemoveUserData(UserDataKey()); | 85 web_state()->RemoveUserData(UserDataKey()); |
| 78 // That was the equivalent of "delete this". This object is now destroyed; | 86 // That was the equivalent of "delete this". This object is now destroyed; |
| 79 // returning from this function is the only safe thing to do. | 87 // returning from this function is the only safe thing to do. |
| 80 } | 88 } |
| 81 | 89 |
| 82 void InfoBarManagerImpl::OpenURL(const GURL& url, | 90 void InfoBarManagerImpl::OpenURL(const GURL& url, |
| 83 WindowOpenDisposition disposition) { | 91 WindowOpenDisposition disposition) { |
| 84 NOTIMPLEMENTED(); | 92 NOTIMPLEMENTED(); |
| 85 } | 93 } |
| OLD | NEW |