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

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: Rebase + Addressed comments 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 WindowOpenDisposition disposition, 90 WindowOpenDisposition disposition,
91 bool is_search_type) { 91 bool is_search_type) {
92 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate( 92 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate(
93 render_view()->GetRoutingID(), render_view()->GetPageId(), 93 render_view()->GetRoutingID(), render_view()->GetPageId(),
94 url, transition, disposition, is_search_type)); 94 url, transition, disposition, is_search_type));
95 } 95 }
96 96
97 void SearchBox::DeleteMostVisitedItem( 97 void SearchBox::DeleteMostVisitedItem(
98 InstantRestrictedID most_visited_item_id) { 98 InstantRestrictedID most_visited_item_id) {
99 render_view()->Send(new ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem( 99 render_view()->Send(new ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem(
100 render_view()->GetRoutingID(), most_visited_item_id)); 100 render_view()->GetRoutingID(),
101 GetURLForMostVisitedItem(most_visited_item_id)));
101 } 102 }
102 103
103 void SearchBox::UndoMostVisitedDeletion( 104 void SearchBox::UndoMostVisitedDeletion(
104 InstantRestrictedID most_visited_item_id) { 105 InstantRestrictedID most_visited_item_id) {
105 render_view()->Send(new ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion( 106 render_view()->Send(new ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion(
106 render_view()->GetRoutingID(), most_visited_item_id)); 107 render_view()->GetRoutingID(),
108 GetURLForMostVisitedItem(most_visited_item_id)));
107 } 109 }
108 110
109 void SearchBox::UndoAllMostVisitedDeletions() { 111 void SearchBox::UndoAllMostVisitedDeletions() {
110 render_view()->Send( 112 render_view()->Send(
111 new ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions( 113 new ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions(
112 render_view()->GetRoutingID())); 114 render_view()->GetRoutingID()));
113 } 115 }
114 116
115 void SearchBox::ShowBars() { 117 void SearchBox::ShowBars() {
116 DVLOG(1) << render_view() << " ShowBars"; 118 DVLOG(1) << render_view() << " ShowBars";
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 std::vector<InstantMostVisitedItemIDPair>* items) const { 401 std::vector<InstantMostVisitedItemIDPair>* items) const {
400 return most_visited_items_cache_.GetCurrentItems(items); 402 return most_visited_items_cache_.GetCurrentItems(items);
401 } 403 }
402 404
403 bool SearchBox::GetMostVisitedItemWithID( 405 bool SearchBox::GetMostVisitedItemWithID(
404 InstantRestrictedID most_visited_item_id, 406 InstantRestrictedID most_visited_item_id,
405 InstantMostVisitedItem* item) const { 407 InstantMostVisitedItem* item) const {
406 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id, 408 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id,
407 item); 409 item);
408 } 410 }
411
412 GURL SearchBox::GetURLForMostVisitedItem(InstantRestrictedID item_id) const {
413 InstantMostVisitedItem item;
414 return GetMostVisitedItemWithID(item_id, &item) ? item.url : GURL();
415 }
OLDNEW
« chrome/common/instant_restricted_id_cache.h ('K') | « chrome/renderer/searchbox/searchbox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698