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

Side by Side Diff: chrome/renderer/searchbox/searchbox.cc

Issue 14660022: Move most visited item state info from InstantController to InstantService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 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 | 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/renderer/searchbox/searchbox.h" 5 #include "chrome/renderer/searchbox/searchbox.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/omnibox_focus_state.h" 10 #include "chrome/common/omnibox_focus_state.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 content::PageTransition transition, 119 content::PageTransition transition,
120 WindowOpenDisposition disposition) { 120 WindowOpenDisposition disposition) {
121 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate( 121 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate(
122 render_view()->GetRoutingID(), render_view()->GetPageId(), 122 render_view()->GetRoutingID(), render_view()->GetPageId(),
123 url, transition, disposition)); 123 url, transition, disposition));
124 } 124 }
125 125
126 void SearchBox::DeleteMostVisitedItem( 126 void SearchBox::DeleteMostVisitedItem(
127 InstantRestrictedID most_visited_item_id) { 127 InstantRestrictedID most_visited_item_id) {
128 render_view()->Send(new ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem( 128 render_view()->Send(new ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem(
129 render_view()->GetRoutingID(), most_visited_item_id)); 129 render_view()->GetRoutingID(),
130 GetURLForMostVisitedItem(most_visited_item_id)));
130 } 131 }
131 132
132 void SearchBox::UndoMostVisitedDeletion( 133 void SearchBox::UndoMostVisitedDeletion(
133 InstantRestrictedID most_visited_item_id) { 134 InstantRestrictedID most_visited_item_id) {
134 render_view()->Send(new ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion( 135 render_view()->Send(new ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion(
135 render_view()->GetRoutingID(), most_visited_item_id)); 136 render_view()->GetRoutingID(),
137 GetURLForMostVisitedItem(most_visited_item_id)));
136 } 138 }
137 139
138 void SearchBox::UndoAllMostVisitedDeletions() { 140 void SearchBox::UndoAllMostVisitedDeletions() {
139 render_view()->Send( 141 render_view()->Send(
140 new ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions( 142 new ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions(
141 render_view()->GetRoutingID())); 143 render_view()->GetRoutingID()));
142 } 144 }
143 145
144 void SearchBox::ShowBars() { 146 void SearchBox::ShowBars() {
145 DVLOG(1) << render_view() << " ShowBars"; 147 DVLOG(1) << render_view() << " ShowBars";
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 std::vector<InstantMostVisitedItemIDPair>* items) const { 437 std::vector<InstantMostVisitedItemIDPair>* items) const {
436 return most_visited_items_cache_.GetCurrentItems(items); 438 return most_visited_items_cache_.GetCurrentItems(items);
437 } 439 }
438 440
439 bool SearchBox::GetMostVisitedItemWithID( 441 bool SearchBox::GetMostVisitedItemWithID(
440 InstantRestrictedID most_visited_item_id, 442 InstantRestrictedID most_visited_item_id,
441 InstantMostVisitedItem* item) const { 443 InstantMostVisitedItem* item) const {
442 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id, 444 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id,
443 item); 445 item);
444 } 446 }
447
448 GURL SearchBox::GetURLForMostVisitedItem(InstantRestrictedID item_id) const {
449 InstantMostVisitedItem item;
450 return GetMostVisitedItemWithID(item_id, &item) ? item.url : GURL();
451 }
OLDNEW
« chrome/browser/ui/search/instant_page_unittest.cc ('K') | « chrome/renderer/searchbox/searchbox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698