| 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/browser/ui/search/search_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/search/search.h" | 7 #include "chrome/browser/search/search.h" |
| 8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "content/public/browser/navigation_entry.h" | 10 #include "content/public/browser/navigation_entry.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 UpdateMode(); | 68 UpdateMode(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void SearchTabHelper::NavigationEntryUpdated() { | 71 void SearchTabHelper::NavigationEntryUpdated() { |
| 72 if (!is_search_enabled_) | 72 if (!is_search_enabled_) |
| 73 return; | 73 return; |
| 74 | 74 |
| 75 UpdateMode(); | 75 UpdateMode(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool SearchTabHelper::UpdateLastKnownMostVisitedItems( |
| 79 const std::vector<InstantMostVisitedItem>& items) { |
| 80 if (chrome::AreMostVisitedItemsEqual(items, last_known_most_visited_items_)) |
| 81 return false; |
| 82 |
| 83 last_known_most_visited_items_ = items; |
| 84 return true; |
| 85 } |
| 86 |
| 78 void SearchTabHelper::Observe( | 87 void SearchTabHelper::Observe( |
| 79 int type, | 88 int type, |
| 80 const content::NotificationSource& source, | 89 const content::NotificationSource& source, |
| 81 const content::NotificationDetails& details) { | 90 const content::NotificationDetails& details) { |
| 82 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); | 91 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); |
| 83 UpdateMode(); | 92 UpdateMode(); |
| 84 } | 93 } |
| 85 | 94 |
| 86 bool SearchTabHelper::OnMessageReceived(const IPC::Message& message) { | 95 bool SearchTabHelper::OnMessageReceived(const IPC::Message& message) { |
| 87 bool handled = true; | 96 bool handled = true; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 if (web_contents()->IsActiveEntry(page_id)) | 136 if (web_contents()->IsActiveEntry(page_id)) |
| 128 model_.SetTopBarsVisible(true); | 137 model_.SetTopBarsVisible(true); |
| 129 } | 138 } |
| 130 | 139 |
| 131 void SearchTabHelper::OnSearchBoxHideBars(int page_id) { | 140 void SearchTabHelper::OnSearchBoxHideBars(int page_id) { |
| 132 if (web_contents()->IsActiveEntry(page_id)) { | 141 if (web_contents()->IsActiveEntry(page_id)) { |
| 133 model_.SetTopBarsVisible(false); | 142 model_.SetTopBarsVisible(false); |
| 134 Send(new ChromeViewMsg_SearchBoxBarsHidden(routing_id())); | 143 Send(new ChromeViewMsg_SearchBoxBarsHidden(routing_id())); |
| 135 } | 144 } |
| 136 } | 145 } |
| OLD | NEW |