OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/search_engines/chrome_template_url_service_client.h" | 5 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "components/history/core/browser/history_service.h" | 8 #include "components/history/core/browser/history_service.h" |
9 #include "components/search_engines/template_url_service.h" | 9 #include "components/search_engines/template_url_service.h" |
10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 history::SOURCE_BROWSED, false); | 63 history::SOURCE_BROWSED, false); |
64 } | 64 } |
65 | 65 |
66 void ChromeTemplateURLServiceClient::RestoreExtensionInfoIfNecessary( | 66 void ChromeTemplateURLServiceClient::RestoreExtensionInfoIfNecessary( |
67 TemplateURL* template_url) { | 67 TemplateURL* template_url) { |
68 const TemplateURLData& data = template_url->data(); | 68 const TemplateURLData& data = template_url->data(); |
69 GURL url(data.url()); | 69 GURL url(data.url()); |
70 if (url.SchemeIs(extensions::kExtensionScheme)) { | 70 if (url.SchemeIs(extensions::kExtensionScheme)) { |
71 const std::string& extension_id = url.host(); | 71 const std::string& extension_id = url.host(); |
72 template_url->set_extension_info( | 72 template_url->set_extension_info( |
73 base::MakeUnique<TemplateURL::AssociatedExtensionInfo>( | 73 base::MakeUnique<TemplateURL::AssociatedExtensionInfo>(extension_id)); |
74 TemplateURL::OMNIBOX_API_EXTENSION, extension_id)); | 74 template_url->set_type(TemplateURL::OMNIBOX_API_EXTENSION); |
Peter Kasting
2016/09/21 21:45:08
This was the thing that worried me, looking throug
Ian Wen
2016/09/21 23:12:38
Added a todo track this. Agreed that we shouldn't
| |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 void ChromeTemplateURLServiceClient::OnURLVisited( | 78 void ChromeTemplateURLServiceClient::OnURLVisited( |
79 history::HistoryService* history_service, | 79 history::HistoryService* history_service, |
80 ui::PageTransition transition, | 80 ui::PageTransition transition, |
81 const history::URLRow& row, | 81 const history::URLRow& row, |
82 const history::RedirectList& redirects, | 82 const history::RedirectList& redirects, |
83 base::Time visit_time) { | 83 base::Time visit_time) { |
84 DCHECK_EQ(history_service_, history_service); | 84 DCHECK_EQ(history_service_, history_service); |
85 if (!owner_) | 85 if (!owner_) |
86 return; | 86 return; |
87 | 87 |
88 TemplateURLService::URLVisitedDetails visited_details; | 88 TemplateURLService::URLVisitedDetails visited_details; |
89 visited_details.url = row.url(); | 89 visited_details.url = row.url(); |
90 visited_details.is_keyword_transition = | 90 visited_details.is_keyword_transition = |
91 ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_KEYWORD); | 91 ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_KEYWORD); |
92 owner_->OnHistoryURLVisited(visited_details); | 92 owner_->OnHistoryURLVisited(visited_details); |
93 } | 93 } |
OLD | NEW |