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

Issue 10879043: Centralize logic around Instant modes. (Closed)

Created:
8 years, 4 months ago by sreeram
Modified:
8 years, 3 months ago
Reviewers:
Peter Kasting, sky
CC:
chromium-reviews, sadrul, ben+watch_chromium.org, tfarina, gideonwald, dominich, David Black, Jered, James Su, Shishir
Visibility:
Public.

Description

Centralize logic around Instant modes. The goal of this change is to have callers go through InstantController to check if it's enabled (in any of a variety of modes), as opposed to checking prefs::kInstantEnabled directly. This is because we plan to add field trials, command-line forced modes and default modes that may cause Instant to be in a given mode regardless of this pref. At the moment however, there's no change in functionality. BUG=none R=pkasting@chromium.org,sky@chromium.org TEST=none; no change in functionality, as the SUGGEST mode is not actually used at the moment. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=154809

Patch Set 1 #

Patch Set 2 : Directly call into SearchProvider #

Total comments: 2

Patch Set 3 : Fix tests #

Total comments: 6

Patch Set 4 : unix_hacker() style #

Patch Set 5 : profile keyed #

Total comments: 6

Patch Set 6 : renamed to CreateInstant; fixed ordering #

Total comments: 12

Patch Set 7 : Fixed nits #

Patch Set 8 : Fix a few more style nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+104 lines, -74 lines) Patch
M chrome/browser/autocomplete/search_provider.cc View 1 2 3 4 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/autocomplete/search_provider_unittest.cc View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/instant/instant_controller.h View 1 2 3 4 5 6 2 chunks +27 lines, -9 lines 0 comments Download
M chrome/browser/instant/instant_controller.cc View 1 2 3 4 5 6 7 10 chunks +55 lines, -30 lines 0 comments Download
M chrome/browser/instant/instant_loader.cc View 1 2 3 4 5 6 7 6 chunks +7 lines, -13 lines 0 comments Download
M chrome/browser/search_engines/search_terms_data.cc View 1 2 3 4 2 chunks +4 lines, -5 lines 0 comments Download
M chrome/browser/ui/browser_instant_controller.cc View 1 2 3 4 5 6 2 chunks +6 lines, -13 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
sreeram
Please review.
8 years, 4 months ago (2012-08-23 17:37:54 UTC) #1
sky
I don't like having this code depend upon browser. It should use a more narrow ...
8 years, 4 months ago (2012-08-23 19:45:55 UTC) #2
sreeram
On 2012/08/23 19:45:55, sky wrote: > I don't like having this code depend upon browser. ...
8 years, 4 months ago (2012-08-23 22:39:12 UTC) #3
sky
On 2012/08/23 22:39:12, sreeram wrote: > On 2012/08/23 19:45:55, sky wrote: > > I don't ...
8 years, 4 months ago (2012-08-24 16:22:14 UTC) #4
sreeram
On Fri, Aug 24, 2012 at 9:22 AM, <sky@chromium.org> wrote: > On 2012/08/23 22:39:12, sreeram ...
8 years, 4 months ago (2012-08-24 16:34:08 UTC) #5
sreeram
On 2012/08/24 16:34:08, sreeram wrote: > On Fri, Aug 24, 2012 at 9:22 AM, <mailto:sky@chromium.org> ...
8 years, 4 months ago (2012-08-24 18:32:51 UTC) #6
sky
http://codereview.chromium.org/10879043/diff/7002/chrome/browser/ui/omnibox/omnibox_edit_model.cc File chrome/browser/ui/omnibox/omnibox_edit_model.cc (right): http://codereview.chromium.org/10879043/diff/7002/chrome/browser/ui/omnibox/omnibox_edit_model.cc#newcode435 chrome/browser/ui/omnibox/omnibox_edit_model.cc:435: search_provider->set_instant_suggest_enabled(controller_->GetInstant() && Don't you need to NULL check instant?
8 years, 4 months ago (2012-08-24 19:11:52 UTC) #7
sreeram
http://codereview.chromium.org/10879043/diff/7002/chrome/browser/ui/omnibox/omnibox_edit_model.cc File chrome/browser/ui/omnibox/omnibox_edit_model.cc (right): http://codereview.chromium.org/10879043/diff/7002/chrome/browser/ui/omnibox/omnibox_edit_model.cc#newcode435 chrome/browser/ui/omnibox/omnibox_edit_model.cc:435: search_provider->set_instant_suggest_enabled(controller_->GetInstant() && On 2012/08/24 19:11:52, sky wrote: > Don't ...
8 years, 4 months ago (2012-08-24 19:15:28 UTC) #8
sky
My mistake, LGTM
8 years, 4 months ago (2012-08-24 19:21:37 UTC) #9
Peter Kasting
http://codereview.chromium.org/10879043/diff/5005/chrome/browser/instant/instant_controller.h File chrome/browser/instant/instant_controller.h (right): http://codereview.chromium.org/10879043/diff/5005/chrome/browser/instant/instant_controller.h#newcode139 chrome/browser/instant/instant_controller.h:139: bool IsSuggestEnabled() const { Nit: This should be unix_hacker()-style ...
8 years, 4 months ago (2012-08-24 22:29:52 UTC) #10
sreeram
http://codereview.chromium.org/10879043/diff/5005/chrome/browser/instant/instant_controller.h File chrome/browser/instant/instant_controller.h (right): http://codereview.chromium.org/10879043/diff/5005/chrome/browser/instant/instant_controller.h#newcode139 chrome/browser/instant/instant_controller.h:139: bool IsSuggestEnabled() const { On 2012/08/24 22:29:52, Peter Kasting ...
8 years, 4 months ago (2012-08-24 23:18:11 UTC) #11
Peter Kasting
http://codereview.chromium.org/10879043/diff/5005/chrome/browser/ui/omnibox/omnibox_edit_model.cc File chrome/browser/ui/omnibox/omnibox_edit_model.cc (right): http://codereview.chromium.org/10879043/diff/5005/chrome/browser/ui/omnibox/omnibox_edit_model.cc#newcode433 chrome/browser/ui/omnibox/omnibox_edit_model.cc:433: SearchProvider* search_provider = autocomplete_controller_->search_provider(); On 2012/08/24 23:18:12, sreeram wrote: ...
8 years, 4 months ago (2012-08-24 23:25:44 UTC) #12
sreeram
http://codereview.chromium.org/10879043/diff/5005/chrome/browser/ui/omnibox/omnibox_edit_model.cc File chrome/browser/ui/omnibox/omnibox_edit_model.cc (right): http://codereview.chromium.org/10879043/diff/5005/chrome/browser/ui/omnibox/omnibox_edit_model.cc#newcode433 chrome/browser/ui/omnibox/omnibox_edit_model.cc:433: SearchProvider* search_provider = autocomplete_controller_->search_provider(); On 2012/08/24 23:25:44, Peter Kasting ...
8 years, 4 months ago (2012-08-24 23:38:58 UTC) #13
Peter Kasting
On 2012/08/24 23:38:58, sreeram wrote: > On 2012/08/24 23:25:44, Peter Kasting wrote: > > What ...
8 years, 4 months ago (2012-08-24 23:47:31 UTC) #14
sky
Personally I like injecting; it means less dependencies on external objects and is easier to ...
8 years, 4 months ago (2012-08-25 00:01:00 UTC) #15
Peter Kasting
On 2012/08/25 00:01:00, sky wrote: > Personally I like injecting; it means less dependencies on ...
8 years, 4 months ago (2012-08-25 00:12:56 UTC) #16
sreeram
On 2012/08/24 23:47:31, Peter Kasting wrote: > The mode should be the same for all ...
8 years, 4 months ago (2012-08-25 00:35:12 UTC) #17
sky
All good points. Thanks. -Scott On Fri, Aug 24, 2012 at 5:12 PM, <pkasting@chromium.org> wrote: ...
8 years, 3 months ago (2012-08-27 14:14:01 UTC) #18
sreeram
PTAL. The goal of this change is to have callers go through InstantController to check ...
8 years, 3 months ago (2012-08-30 21:57:55 UTC) #19
sky
Just nits http://codereview.chromium.org/10879043/diff/15001/chrome/browser/instant/instant_controller.cc File chrome/browser/instant/instant_controller.cc (right): http://codereview.chromium.org/10879043/diff/15001/chrome/browser/instant/instant_controller.cc#newcode129 chrome/browser/instant/instant_controller.cc:129: const Mode mode = GetModeForProfile(profile); nit: combine ...
8 years, 3 months ago (2012-08-30 22:33:13 UTC) #20
sreeram
http://codereview.chromium.org/10879043/diff/15001/chrome/browser/instant/instant_controller.cc File chrome/browser/instant/instant_controller.cc (right): http://codereview.chromium.org/10879043/diff/15001/chrome/browser/instant/instant_controller.cc#newcode129 chrome/browser/instant/instant_controller.cc:129: const Mode mode = GetModeForProfile(profile); On 2012/08/30 22:33:13, sky ...
8 years, 3 months ago (2012-08-30 23:23:51 UTC) #21
sky
LGTM
8 years, 3 months ago (2012-08-30 23:51:00 UTC) #22
Peter Kasting
LGTM http://codereview.chromium.org/10879043/diff/21002/chrome/browser/instant/instant_controller.cc File chrome/browser/instant/instant_controller.cc (right): http://codereview.chromium.org/10879043/diff/21002/chrome/browser/instant/instant_controller.cc#newcode116 chrome/browser/instant/instant_controller.cc:116: profile->GetPrefs()->GetBoolean(prefs::kInstantEnabled)) { Nit: If you reverse this conditional ...
8 years, 3 months ago (2012-08-31 01:51:19 UTC) #23
sreeram
8 years, 3 months ago (2012-09-04 17:42:16 UTC) #24
http://codereview.chromium.org/10879043/diff/21002/chrome/browser/instant/ins...
File chrome/browser/instant/instant_controller.cc (right):

http://codereview.chromium.org/10879043/diff/21002/chrome/browser/instant/ins...
chrome/browser/instant/instant_controller.cc:116:
profile->GetPrefs()->GetBoolean(prefs::kInstantEnabled)) {
On 2012/08/31 01:51:19, Peter Kasting wrote:
> Nit: If you reverse this conditional you can omit the {} because the body will
> be one line.

Done.

http://codereview.chromium.org/10879043/diff/21002/chrome/browser/instant/ins...
chrome/browser/instant/instant_controller.cc:117: if
(chrome::search::IsInstantExtendedAPIEnabled(profile))
On 2012/08/31 01:51:19, Peter Kasting wrote:
> Nit: Also could use ?:

Done.

http://codereview.chromium.org/10879043/diff/21002/chrome/browser/instant/ins...
chrome/browser/instant/instant_controller.cc:204: string16 last_query_text =
mode_ == EXTENDED ? last_user_text_ :
On 2012/08/31 01:51:19, Peter Kasting wrote:
> Nit: Wrap after '?' instead

Done.

http://codereview.chromium.org/10879043/diff/21002/chrome/browser/instant/ins...
File chrome/browser/instant/instant_controller.h (right):

http://codereview.chromium.org/10879043/diff/21002/chrome/browser/instant/ins...
chrome/browser/instant/instant_controller.h:53: //   EXTENDED: Similar to
INSTANT, but with extended functionality, such as
On 2012/08/31 01:51:19, Peter Kasting wrote:
> Nit: Might make sense to write the full description here and then have
"INSTANT"
> say "like EXTENDED, but without XXX".  Or, put EXTENDED just after INSTANT.

Done.

http://codereview.chromium.org/10879043/diff/21002/chrome/browser/instant/ins...
chrome/browser/instant/instant_controller.h:77: // disabled in this profile.
On 2012/08/31 01:51:19, Peter Kasting wrote:
> Is it legal to call this multiple times on the same profile?
> 
> If not, this API seems a bit prone to misuse... should the InstantController
> become a full-fledged ProfileKeyedService?  That seems like it might be a lot
> more standard to how most Chrome services work.

Yes, it's legal to call it multiple times. I think the name and comments make it
clear that each invocation results in a new InstantController object being
created (and returned to the caller who then owns it).

http://codereview.chromium.org/10879043/diff/21002/chrome/browser/ui/browser_...
File chrome/browser/ui/browser_instant_controller.cc (right):

http://codereview.chromium.org/10879043/diff/21002/chrome/browser/ui/browser_...
chrome/browser/ui/browser_instant_controller.cc:174: browser_->is_type_tabbed())
{
On 2012/08/31 01:51:19, Peter Kasting wrote:
> Nit: No {} (2 places).
> 
> Another option: Use "XXX ? new YYY : NULL" in both reset() calls.

Done.

Powered by Google App Engine
This is Rietveld 408576698