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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 bool SearchTabHelper::UpdateLastKnownMostVisitedItems( | 78 bool SearchTabHelper::UpdateLastKnownMostVisitedItems( |
79 const std::vector<InstantMostVisitedItem>& items) { | 79 const std::vector<InstantMostVisitedItem>& items) { |
80 if (chrome::AreMostVisitedItemsEqual(items, last_known_most_visited_items_)) | 80 if (chrome::AreMostVisitedItemsEqual(items, last_known_most_visited_items_)) |
81 return false; | 81 return false; |
82 | 82 |
83 last_known_most_visited_items_ = items; | 83 last_known_most_visited_items_ = items; |
84 return true; | 84 return true; |
85 } | 85 } |
86 | 86 |
| 87 bool SearchTabHelper::UpdateLastKnownThemeBackgroundInfo( |
| 88 const ThemeBackgroundInfo& theme_info) { |
| 89 if (last_known_theme_info_ == theme_info) |
| 90 return false; |
| 91 |
| 92 last_known_theme_info_ = theme_info; |
| 93 return true; |
| 94 } |
| 95 |
87 void SearchTabHelper::Observe( | 96 void SearchTabHelper::Observe( |
88 int type, | 97 int type, |
89 const content::NotificationSource& source, | 98 const content::NotificationSource& source, |
90 const content::NotificationDetails& details) { | 99 const content::NotificationDetails& details) { |
91 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); | 100 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); |
92 UpdateMode(); | 101 UpdateMode(); |
93 last_known_most_visited_items_.clear(); | 102 last_known_most_visited_items_.clear(); |
| 103 last_known_theme_info_ = ThemeBackgroundInfo(); |
94 } | 104 } |
95 | 105 |
96 bool SearchTabHelper::OnMessageReceived(const IPC::Message& message) { | 106 bool SearchTabHelper::OnMessageReceived(const IPC::Message& message) { |
97 bool handled = true; | 107 bool handled = true; |
98 IPC_BEGIN_MESSAGE_MAP(SearchTabHelper, message) | 108 IPC_BEGIN_MESSAGE_MAP(SearchTabHelper, message) |
99 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxShowBars, | 109 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxShowBars, |
100 OnSearchBoxShowBars) | 110 OnSearchBoxShowBars) |
101 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxHideBars, | 111 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxHideBars, |
102 OnSearchBoxHideBars) | 112 OnSearchBoxHideBars) |
103 IPC_MESSAGE_UNHANDLED(handled = false) | 113 IPC_MESSAGE_UNHANDLED(handled = false) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 if (web_contents()->IsActiveEntry(page_id)) | 147 if (web_contents()->IsActiveEntry(page_id)) |
138 model_.SetTopBarsVisible(true); | 148 model_.SetTopBarsVisible(true); |
139 } | 149 } |
140 | 150 |
141 void SearchTabHelper::OnSearchBoxHideBars(int page_id) { | 151 void SearchTabHelper::OnSearchBoxHideBars(int page_id) { |
142 if (web_contents()->IsActiveEntry(page_id)) { | 152 if (web_contents()->IsActiveEntry(page_id)) { |
143 model_.SetTopBarsVisible(false); | 153 model_.SetTopBarsVisible(false); |
144 Send(new ChromeViewMsg_SearchBoxBarsHidden(routing_id())); | 154 Send(new ChromeViewMsg_SearchBoxBarsHidden(routing_id())); |
145 } | 155 } |
146 } | 156 } |
OLD | NEW |