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

Side by Side Diff: chrome/browser/ui/search/instant_controller.cc

Issue 2845303002: Remove InstantTab::Delegate::InstantSupportDetermined (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « chrome/browser/ui/search/instant_controller.h ('k') | chrome/browser/ui/search/instant_tab.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ui/search/instant_controller.h" 5 #include "chrome/browser/ui/search/instant_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 InstantSupportState instant_support) { 66 InstantSupportState instant_support) {
67 // Handle INSTANT_SUPPORT_YES here because InstantTab is not hooked up to the 67 // Handle INSTANT_SUPPORT_YES here because InstantTab is not hooked up to the
68 // active tab. Search model changed listener in InstantTab will handle other 68 // active tab. Search model changed listener in InstantTab will handle other
69 // cases. 69 // cases.
70 if (instant_support != INSTANT_SUPPORT_YES) 70 if (instant_support != INSTANT_SUPPORT_YES)
71 return; 71 return;
72 72
73 ResetInstantTab(); 73 ResetInstantTab();
74 } 74 }
75 75
76 void InstantController::InstantSupportDetermined(
77 const content::WebContents* contents,
78 bool supports_instant) {
79 DCHECK(IsContentsFrom(instant_tab_.get(), contents));
80
81 if (!supports_instant) {
82 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE,
83 instant_tab_.release());
84 }
85 }
86
87 void InstantController::InstantTabAboutToNavigateMainFrame( 76 void InstantController::InstantTabAboutToNavigateMainFrame(
88 const content::WebContents* contents, 77 const content::WebContents* contents,
89 const GURL& url) { 78 const GURL& url) {
90 DCHECK(IsContentsFrom(instant_tab_.get(), contents)); 79 DCHECK(IsContentsFrom(instant_tab_.get(), contents));
91 80
92 // The Instant tab navigated. Send it the data it needs to display 81 // The Instant tab navigated. Send it the data it needs to display
93 // properly. 82 // properly.
94 UpdateInfoForInstantTab(); 83 UpdateInfoForInstantTab();
95 } 84 }
96 85
97 void InstantController::ResetInstantTab() { 86 void InstantController::ResetInstantTab() {
98 if (!search_mode_.is_origin_default()) { 87 if (search_mode_.is_origin_ntp()) {
99 content::WebContents* active_tab = browser_->GetActiveWebContents(); 88 content::WebContents* active_tab = browser_->GetActiveWebContents();
100 if (!instant_tab_ || active_tab != instant_tab_->web_contents()) { 89 if (!instant_tab_ || active_tab != instant_tab_->web_contents()) {
101 instant_tab_.reset(new InstantTab(this, active_tab)); 90 instant_tab_.reset(new InstantTab(this, active_tab));
102 instant_tab_->Init(); 91 instant_tab_->Init();
103 UpdateInfoForInstantTab(); 92 UpdateInfoForInstantTab();
104 } 93 }
105 } else { 94 } else {
106 instant_tab_.reset(); 95 instant_tab_.reset();
107 } 96 }
108 } 97 }
109 98
110 void InstantController::UpdateInfoForInstantTab() { 99 void InstantController::UpdateInfoForInstantTab() {
111 if (instant_tab_) { 100 if (instant_tab_) {
112 // Update theme details. 101 // Update theme details.
113 InstantService* instant_service = GetInstantService(); 102 InstantService* instant_service = GetInstantService();
114 if (instant_service) { 103 if (instant_service) {
115 instant_service->UpdateThemeInfo(); 104 instant_service->UpdateThemeInfo();
116 instant_service->UpdateMostVisitedItemsInfo(); 105 instant_service->UpdateMostVisitedItemsInfo();
117 } 106 }
118 } 107 }
119 } 108 }
120 109
121 InstantService* InstantController::GetInstantService() const { 110 InstantService* InstantController::GetInstantService() const {
122 return InstantServiceFactory::GetForProfile(browser_->profile()); 111 return InstantServiceFactory::GetForProfile(browser_->profile());
123 } 112 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_controller.h ('k') | chrome/browser/ui/search/instant_tab.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698