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> | 7 #include <utility> |
8 | 8 |
9 #include "components/infobars/core/confirm_infobar_delegate.h" | 9 #include "components/infobars/core/confirm_infobar_delegate.h" |
10 #include "components/infobars/core/infobar.h" | 10 #include "components/infobars/core/infobar.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 InfoBarManagerImpl::~InfoBarManagerImpl() { | 55 InfoBarManagerImpl::~InfoBarManagerImpl() { |
56 ShutDown(); | 56 ShutDown(); |
57 } | 57 } |
58 | 58 |
59 int InfoBarManagerImpl::GetActiveEntryID() { | 59 int InfoBarManagerImpl::GetActiveEntryID() { |
60 web::NavigationItem* visible_item = | 60 web::NavigationItem* visible_item = |
61 web_state()->GetNavigationManager()->GetVisibleItem(); | 61 web_state()->GetNavigationManager()->GetVisibleItem(); |
62 return visible_item ? visible_item->GetUniqueID() : 0; | 62 return visible_item ? visible_item->GetUniqueID() : 0; |
63 } | 63 } |
64 | 64 |
65 scoped_ptr<infobars::InfoBar> InfoBarManagerImpl::CreateConfirmInfoBar( | 65 std::unique_ptr<infobars::InfoBar> InfoBarManagerImpl::CreateConfirmInfoBar( |
66 scoped_ptr<ConfirmInfoBarDelegate> delegate) { | 66 std::unique_ptr<ConfirmInfoBarDelegate> delegate) { |
67 return ::CreateConfirmInfoBar(std::move(delegate)); | 67 return ::CreateConfirmInfoBar(std::move(delegate)); |
68 } | 68 } |
69 | 69 |
70 void InfoBarManagerImpl::NavigationItemCommitted( | 70 void InfoBarManagerImpl::NavigationItemCommitted( |
71 const web::LoadCommittedDetails& load_details) { | 71 const web::LoadCommittedDetails& load_details) { |
72 OnNavigation(NavigationDetailsFromLoadCommittedDetails(load_details)); | 72 OnNavigation(NavigationDetailsFromLoadCommittedDetails(load_details)); |
73 } | 73 } |
74 | 74 |
75 void InfoBarManagerImpl::WebStateDestroyed() { | 75 void InfoBarManagerImpl::WebStateDestroyed() { |
76 // The WebState is going away; be aggressively paranoid and delete this | 76 // The WebState is going away; be aggressively paranoid and delete this |
77 // InfoBarManagerImpl lest other parts of the system attempt to add infobars | 77 // InfoBarManagerImpl lest other parts of the system attempt to add infobars |
78 // or use it otherwise during the destruction. | 78 // or use it otherwise during the destruction. |
79 web_state()->RemoveUserData(UserDataKey()); | 79 web_state()->RemoveUserData(UserDataKey()); |
80 // That was the equivalent of "delete this". This object is now destroyed; | 80 // That was the equivalent of "delete this". This object is now destroyed; |
81 // returning from this function is the only safe thing to do. | 81 // returning from this function is the only safe thing to do. |
82 } | 82 } |
83 | 83 |
84 void InfoBarManagerImpl::OpenURL(const GURL& url, | 84 void InfoBarManagerImpl::OpenURL(const GURL& url, |
85 WindowOpenDisposition disposition) { | 85 WindowOpenDisposition disposition) { |
86 NOTIMPLEMENTED(); | 86 NOTIMPLEMENTED(); |
87 } | 87 } |
OLD | NEW |