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

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

Issue 12771013: Instant: Make clicks on Most Visited items work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cancel 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
« no previous file with comments | « no previous file | chrome/renderer/resources/extensions/searchbox_api.js » ('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/instant/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 // There may re-entrance here, from the call to browser_->CommitInstant below, 601 // There may re-entrance here, from the call to browser_->CommitInstant below,
602 // which can cause a TabDeactivated notification which gets back here. 602 // which can cause a TabDeactivated notification which gets back here.
603 // In this case, overlay_->ReleaseContents() was called already. 603 // In this case, overlay_->ReleaseContents() was called already.
604 if (!GetOverlayContents()) 604 if (!GetOverlayContents())
605 return false; 605 return false;
606 606
607 // Never commit the local overlay. 607 // Never commit the local overlay.
608 if (overlay_->IsUsingLocalOverlay()) 608 if (overlay_->IsUsingLocalOverlay())
609 return false; 609 return false;
610 610
611 if (type == INSTANT_COMMIT_FOCUS_LOST) 611 if (type == INSTANT_COMMIT_FOCUS_LOST) {
612 overlay_->Cancel(last_omnibox_text_); 612 // Extended mode doesn't need or use the Cancel message.
613 else if (type != INSTANT_COMMIT_NAVIGATED) 613 if (!extended_enabled_)
614 overlay_->Cancel(last_omnibox_text_);
615 } else if (type != INSTANT_COMMIT_NAVIGATED) {
614 overlay_->Submit(last_omnibox_text_); 616 overlay_->Submit(last_omnibox_text_);
617 }
615 618
616 scoped_ptr<content::WebContents> overlay = overlay_->ReleaseContents(); 619 scoped_ptr<content::WebContents> overlay = overlay_->ReleaseContents();
617 620
618 // If the overlay page has navigated since the last Update(), we need to add 621 // If the overlay page has navigated since the last Update(), we need to add
619 // the navigation to history ourselves. Else, the page will navigate after 622 // the navigation to history ourselves. Else, the page will navigate after
620 // commit, and it will be added to history in the usual manner. 623 // commit, and it will be added to history in the usual manner.
621 const history::HistoryAddPageArgs& last_navigation = 624 const history::HistoryAddPageArgs& last_navigation =
622 overlay_->last_navigation(); 625 overlay_->last_navigation();
623 if (!last_navigation.url.is_empty()) { 626 if (!last_navigation.url.is_empty()) {
624 content::NavigationEntry* entry = overlay->GetController().GetActiveEntry(); 627 content::NavigationEntry* entry = overlay->GetController().GetActiveEntry();
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 overlay_->SendMostVisitedItems(items); 1482 overlay_->SendMostVisitedItems(items);
1480 if (ntp_) 1483 if (ntp_)
1481 ntp_->SendMostVisitedItems(items); 1484 ntp_->SendMostVisitedItems(items);
1482 if (instant_tab_) 1485 if (instant_tab_)
1483 instant_tab_->SendMostVisitedItems(items); 1486 instant_tab_->SendMostVisitedItems(items);
1484 content::NotificationService::current()->Notify( 1487 content::NotificationService::current()->Notify(
1485 chrome::NOTIFICATION_INSTANT_SENT_MOST_VISITED_ITEMS, 1488 chrome::NOTIFICATION_INSTANT_SENT_MOST_VISITED_ITEMS,
1486 content::Source<InstantController>(this), 1489 content::Source<InstantController>(this),
1487 content::NotificationService::NoDetails()); 1490 content::NotificationService::NoDetails());
1488 } 1491 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/resources/extensions/searchbox_api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698