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

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

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: include nit Created 7 years, 9 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 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_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 // Update theme info so that the page picks it up. 891 // Update theme info so that the page picks it up.
892 browser_->UpdateThemeInfo(false); 892 browser_->UpdateThemeInfo(false);
893 893
894 // Ensure the searchbox API has the correct initial state. 894 // Ensure the searchbox API has the correct initial state.
895 if (IsContentsFrom(overlay(), contents)) { 895 if (IsContentsFrom(overlay(), contents)) {
896 overlay_->SetDisplayInstantResults(instant_enabled_); 896 overlay_->SetDisplayInstantResults(instant_enabled_);
897 overlay_->KeyCaptureChanged( 897 overlay_->KeyCaptureChanged(
898 omnibox_focus_state_ == OMNIBOX_FOCUS_INVISIBLE); 898 omnibox_focus_state_ == OMNIBOX_FOCUS_INVISIBLE);
899 overlay_->SetMarginSize(start_margin_, end_margin_); 899 overlay_->SetMarginSize(start_margin_, end_margin_);
900 overlay_->InitializeFonts(); 900 overlay_->InitializeFonts();
901 overlay_->GrantAccessFromOrigin(GURL(overlay_->instant_url()));
901 } else if (IsContentsFrom(ntp(), contents)) { 902 } else if (IsContentsFrom(ntp(), contents)) {
902 ntp_->SetDisplayInstantResults(instant_enabled_); 903 ntp_->SetDisplayInstantResults(instant_enabled_);
903 ntp_->SetMarginSize(start_margin_, end_margin_); 904 ntp_->SetMarginSize(start_margin_, end_margin_);
904 ntp_->InitializeFonts(); 905 ntp_->InitializeFonts();
906 ntp_->GrantAccessFromOrigin(GURL(ntp_->instant_url()));
905 } else { 907 } else {
906 NOTREACHED(); 908 NOTREACHED();
907 } 909 }
908 StartListeningToMostVisitedChanges(); 910 StartListeningToMostVisitedChanges();
909 } 911 }
910 912
911 void InstantController::InstantSupportDetermined( 913 void InstantController::InstantSupportDetermined(
912 const content::WebContents* contents, 914 const content::WebContents* contents,
913 bool supports_instant) { 915 bool supports_instant) {
914 if (IsContentsFrom(instant_tab(), contents)) { 916 if (IsContentsFrom(instant_tab(), contents)) {
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 if (!search_mode_.is_origin_default() && !use_local_preview_only_) { 1227 if (!search_mode_.is_origin_default() && !use_local_preview_only_) {
1226 content::WebContents* active_tab = browser_->GetActiveWebContents(); 1228 content::WebContents* active_tab = browser_->GetActiveWebContents();
1227 if (!instant_tab_ || active_tab != instant_tab_->contents()) { 1229 if (!instant_tab_ || active_tab != instant_tab_->contents()) {
1228 instant_tab_.reset(new InstantTab(this)); 1230 instant_tab_.reset(new InstantTab(this));
1229 instant_tab_->Init(active_tab); 1231 instant_tab_->Init(active_tab);
1230 // Update theme info for this tab. 1232 // Update theme info for this tab.
1231 browser_->UpdateThemeInfo(false); 1233 browser_->UpdateThemeInfo(false);
1232 instant_tab_->SetDisplayInstantResults(instant_enabled_); 1234 instant_tab_->SetDisplayInstantResults(instant_enabled_);
1233 instant_tab_->SetMarginSize(start_margin_, end_margin_); 1235 instant_tab_->SetMarginSize(start_margin_, end_margin_);
1234 instant_tab_->InitializeFonts(); 1236 instant_tab_->InitializeFonts();
1237 instant_tab_->GrantAccessFromOrigin(active_tab->GetURL());
1235 StartListeningToMostVisitedChanges(); 1238 StartListeningToMostVisitedChanges();
1236 instant_tab_->KeyCaptureChanged( 1239 instant_tab_->KeyCaptureChanged(
1237 omnibox_focus_state_ == OMNIBOX_FOCUS_INVISIBLE); 1240 omnibox_focus_state_ == OMNIBOX_FOCUS_INVISIBLE);
1238 } 1241 }
1239 1242
1240 // Hide the |overlay_| since we are now using |instant_tab_| instead. 1243 // Hide the |overlay_| since we are now using |instant_tab_| instead.
1241 HideOverlay(); 1244 HideOverlay();
1242 } else { 1245 } else {
1243 instant_tab_.reset(); 1246 instant_tab_.reset();
1244 } 1247 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 overlay_->SendMostVisitedItems(items); 1525 overlay_->SendMostVisitedItems(items);
1523 if (ntp_) 1526 if (ntp_)
1524 ntp_->SendMostVisitedItems(items); 1527 ntp_->SendMostVisitedItems(items);
1525 if (instant_tab_) 1528 if (instant_tab_)
1526 instant_tab_->SendMostVisitedItems(items); 1529 instant_tab_->SendMostVisitedItems(items);
1527 content::NotificationService::current()->Notify( 1530 content::NotificationService::current()->Notify(
1528 chrome::NOTIFICATION_INSTANT_SENT_MOST_VISITED_ITEMS, 1531 chrome::NOTIFICATION_INSTANT_SENT_MOST_VISITED_ITEMS,
1529 content::Source<InstantController>(this), 1532 content::Source<InstantController>(this),
1530 content::NotificationService::NoDetails()); 1533 content::NotificationService::NoDetails());
1531 } 1534 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698