OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |