OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/instant/instant_unload_handler.h" | 5 #include "chrome/browser/ui/search/instant_unload_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 #include "content/public/browser/web_contents_delegate.h" | 13 #include "content/public/browser/web_contents_delegate.h" |
14 | 14 |
15 class InstantUnloadHandler::WebContentsDelegateImpl | 15 class InstantUnloadHandler::WebContentsDelegateImpl |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void InstantUnloadHandler::Destroy(WebContentsDelegateImpl* delegate) { | 97 void InstantUnloadHandler::Destroy(WebContentsDelegateImpl* delegate) { |
98 ScopedVector<WebContentsDelegateImpl>::iterator i = | 98 ScopedVector<WebContentsDelegateImpl>::iterator i = |
99 std::find(delegates_.begin(), delegates_.end(), delegate); | 99 std::find(delegates_.begin(), delegates_.end(), delegate); |
100 DCHECK(i != delegates_.end()); | 100 DCHECK(i != delegates_.end()); |
101 | 101 |
102 // The delegate's method is a caller on the stack, so schedule the deletion | 102 // The delegate's method is a caller on the stack, so schedule the deletion |
103 // for later. | 103 // for later. |
104 delegates_.weak_erase(i); | 104 delegates_.weak_erase(i); |
105 MessageLoop::current()->DeleteSoon(FROM_HERE, delegate); | 105 MessageLoop::current()->DeleteSoon(FROM_HERE, delegate); |
106 } | 106 } |
OLD | NEW |