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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 WindowOpenDisposition disposition, | 91 WindowOpenDisposition disposition, |
92 bool is_search_type) { | 92 bool is_search_type) { |
93 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate( | 93 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate( |
94 render_view()->GetRoutingID(), render_view()->GetPageId(), | 94 render_view()->GetRoutingID(), render_view()->GetPageId(), |
95 url, transition, disposition, is_search_type)); | 95 url, transition, disposition, is_search_type)); |
96 } | 96 } |
97 | 97 |
98 void SearchBox::DeleteMostVisitedItem( | 98 void SearchBox::DeleteMostVisitedItem( |
99 InstantRestrictedID most_visited_item_id) { | 99 InstantRestrictedID most_visited_item_id) { |
100 render_view()->Send(new ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem( | 100 render_view()->Send(new ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem( |
101 render_view()->GetRoutingID(), most_visited_item_id)); | 101 render_view()->GetRoutingID(), |
| 102 GetURLForMostVisitedItem(most_visited_item_id))); |
102 } | 103 } |
103 | 104 |
104 void SearchBox::UndoMostVisitedDeletion( | 105 void SearchBox::UndoMostVisitedDeletion( |
105 InstantRestrictedID most_visited_item_id) { | 106 InstantRestrictedID most_visited_item_id) { |
106 render_view()->Send(new ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion( | 107 render_view()->Send(new ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion( |
107 render_view()->GetRoutingID(), most_visited_item_id)); | 108 render_view()->GetRoutingID(), |
| 109 GetURLForMostVisitedItem(most_visited_item_id))); |
108 } | 110 } |
109 | 111 |
110 void SearchBox::UndoAllMostVisitedDeletions() { | 112 void SearchBox::UndoAllMostVisitedDeletions() { |
111 render_view()->Send( | 113 render_view()->Send( |
112 new ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions( | 114 new ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions( |
113 render_view()->GetRoutingID())); | 115 render_view()->GetRoutingID())); |
114 } | 116 } |
115 | 117 |
116 void SearchBox::ShowBars() { | 118 void SearchBox::ShowBars() { |
117 DVLOG(1) << render_view() << " ShowBars"; | 119 DVLOG(1) << render_view() << " ShowBars"; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 std::vector<InstantMostVisitedItemIDPair>* items) const { | 418 std::vector<InstantMostVisitedItemIDPair>* items) const { |
417 return most_visited_items_cache_.GetCurrentItems(items); | 419 return most_visited_items_cache_.GetCurrentItems(items); |
418 } | 420 } |
419 | 421 |
420 bool SearchBox::GetMostVisitedItemWithID( | 422 bool SearchBox::GetMostVisitedItemWithID( |
421 InstantRestrictedID most_visited_item_id, | 423 InstantRestrictedID most_visited_item_id, |
422 InstantMostVisitedItem* item) const { | 424 InstantMostVisitedItem* item) const { |
423 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id, | 425 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id, |
424 item); | 426 item); |
425 } | 427 } |
| 428 |
| 429 GURL SearchBox::GetURLForMostVisitedItem(InstantRestrictedID item_id) const { |
| 430 InstantMostVisitedItem item; |
| 431 return GetMostVisitedItemWithID(item_id, &item) ? item.url : GURL(); |
| 432 } |
OLD | NEW |