Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Side by Side Diff: chrome/browser/instant/instant_unload_handler.cc

Issue 10836031: Remove Instant v1 API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/instant/instant_unload_handler.h" 5 #include "chrome/browser/instant/instant_unload_handler.h"
6 6
7 #include <algorithm>
8
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_navigator.h" 7 #include "chrome/browser/ui/browser_navigator.h"
11 #include "chrome/browser/ui/tab_contents/tab_contents.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents.h"
12 #include "content/public/browser/render_view_host.h" 9 #include "content/public/browser/render_view_host.h"
13 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_contents_delegate.h" 11 #include "content/public/browser/web_contents_delegate.h"
15 12
16 // WebContentsDelegate implementation. This owns the TabContents supplied to the 13 // WebContentsDelegate implementation. This owns the TabContents supplied to the
17 // constructor. 14 // constructor.
18 class InstantUnloadHandler::WebContentsDelegateImpl 15 class InstantUnloadHandler::WebContentsDelegateImpl
19 : public content::WebContentsDelegate { 16 : public content::WebContentsDelegate {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 89 }
93 90
94 void InstantUnloadHandler::Activate(WebContentsDelegateImpl* delegate) { 91 void InstantUnloadHandler::Activate(WebContentsDelegateImpl* delegate) {
95 // Take ownership of the TabContents from the delegate. 92 // Take ownership of the TabContents from the delegate.
96 TabContents* tab = delegate->ReleaseTab(); 93 TabContents* tab = delegate->ReleaseTab();
97 chrome::NavigateParams params(browser_, tab); 94 chrome::NavigateParams params(browser_, tab);
98 params.disposition = NEW_FOREGROUND_TAB; 95 params.disposition = NEW_FOREGROUND_TAB;
99 params.tabstrip_index = delegate->index(); 96 params.tabstrip_index = delegate->index();
100 97
101 // Remove (and delete) the delegate. 98 // Remove (and delete) the delegate.
102 ScopedVector<WebContentsDelegateImpl>::iterator i = 99 Destroy(delegate);
103 std::find(delegates_.begin(), delegates_.end(), delegate);
104 DCHECK(i != delegates_.end());
105 delegates_.erase(i);
106 delegate = NULL;
107 100
108 // Add the tab back in. 101 // Add the tab back in.
109 chrome::Navigate(&params); 102 chrome::Navigate(&params);
110 } 103 }
111 104
112 void InstantUnloadHandler::Destroy(WebContentsDelegateImpl* delegate) { 105 void InstantUnloadHandler::Destroy(WebContentsDelegateImpl* delegate) {
113 ScopedVector<WebContentsDelegateImpl>::iterator i = 106 ScopedVector<WebContentsDelegateImpl>::iterator i =
114 std::find(delegates_.begin(), delegates_.end(), delegate); 107 std::find(delegates_.begin(), delegates_.end(), delegate);
115 DCHECK(i != delegates_.end()); 108 DCHECK(i != delegates_.end());
116 delegates_.erase(i); 109 delegates_.erase(i);
117 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698