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

Side by Side Diff: chrome/browser/ui/browser_instant_controller.cc

Issue 10879043: Centralize logic around Instant modes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a few more style nits Created 8 years, 3 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
« no previous file with comments | « chrome/browser/search_engines/search_terms_data.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/browser_instant_controller.h" 5 #include "chrome/browser/ui/browser_instant_controller.h"
6 6
7 #include "chrome/browser/browser_shutdown.h" 7 #include "chrome/browser/browser_shutdown.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/instant/instant_controller.h" 9 #include "chrome/browser/instant/instant_controller.h"
10 #include "chrome/browser/instant/instant_unload_handler.h" 10 #include "chrome/browser/instant/instant_unload_handler.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_tabstrip.h" 14 #include "chrome/browser/ui/browser_tabstrip.h"
15 #include "chrome/browser/ui/browser_window.h" 15 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/omnibox/location_bar.h" 16 #include "chrome/browser/ui/omnibox/location_bar.h"
17 #include "chrome/browser/ui/search/search.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" 17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/browser/ui/tab_contents/tab_contents.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents.h"
20 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 19 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
21 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
22 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
23 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
24 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
25 24
26 namespace chrome { 25 namespace chrome {
27 26
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 163
165 void BrowserInstantController::TabDeactivated(TabContents* contents) { 164 void BrowserInstantController::TabDeactivated(TabContents* contents) {
166 if (instant()) 165 if (instant())
167 instant_->Hide(); 166 instant_->Hide();
168 } 167 }
169 168
170 //////////////////////////////////////////////////////////////////////////////// 169 ////////////////////////////////////////////////////////////////////////////////
171 // BrowserInstantController, private: 170 // BrowserInstantController, private:
172 171
173 void BrowserInstantController::ResetInstant() { 172 void BrowserInstantController::ResetInstant() {
174 if (!browser_shutdown::ShuttingDownWithoutClosingBrowsers() && 173 instant_.reset(
175 InstantController::IsEnabled(browser_->profile()) && 174 !browser_shutdown::ShuttingDownWithoutClosingBrowsers() &&
176 browser_->is_type_tabbed() && !browser_->profile()->IsOffTheRecord()) { 175 browser_->is_type_tabbed() ?
177 InstantController::Mode mode = InstantController::INSTANT; 176 InstantController::CreateInstant(browser_->profile(), this) : NULL);
178 if (chrome::search::IsInstantExtendedAPIEnabled(browser_->profile())) 177 instant_unload_handler_.reset(instant() ?
179 mode = InstantController::EXTENDED; 178 new InstantUnloadHandler(browser_) : NULL);
180 instant_.reset(new InstantController(this, mode));
181 instant_unload_handler_.reset(new InstantUnloadHandler(browser_));
182 } else {
183 instant_.reset();
184 instant_unload_handler_.reset();
185 }
186 } 179 }
187 180
188 } // namespace chrome 181 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/search_terms_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698