Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: chrome/browser/search_engines/chrome_template_url_service_client.cc

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/search/search_unittest.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/history/history_notifications.h" 8 #include "chrome/browser/history/history_notifications.h"
9 #include "chrome/browser/history/history_service.h" 9 #include "chrome/browser/history/history_service.h"
10 #include "chrome/browser/history/history_service_factory.h" 10 #include "chrome/browser/history/history_service_factory.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (history_service) 54 if (history_service)
55 history_service->SetKeywordSearchTermsForURL(url, id, term); 55 history_service->SetKeywordSearchTermsForURL(url, id, term);
56 } 56 }
57 57
58 void ChromeTemplateURLServiceClient::AddKeywordGeneratedVisit(const GURL& url) { 58 void ChromeTemplateURLServiceClient::AddKeywordGeneratedVisit(const GURL& url) {
59 HistoryService* history_service = 59 HistoryService* history_service =
60 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); 60 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
61 if (history_service) 61 if (history_service)
62 history_service->AddPage(url, base::Time::Now(), NULL, 0, GURL(), 62 history_service->AddPage(url, base::Time::Now(), NULL, 0, GURL(),
63 history::RedirectList(), 63 history::RedirectList(),
64 content::PAGE_TRANSITION_KEYWORD_GENERATED, 64 ui::PAGE_TRANSITION_KEYWORD_GENERATED,
65 history::SOURCE_BROWSED, false); 65 history::SOURCE_BROWSED, false);
66 } 66 }
67 67
68 void ChromeTemplateURLServiceClient::RestoreExtensionInfoIfNecessary( 68 void ChromeTemplateURLServiceClient::RestoreExtensionInfoIfNecessary(
69 TemplateURL* template_url) { 69 TemplateURL* template_url) {
70 const TemplateURLData& data = template_url->data(); 70 const TemplateURLData& data = template_url->data();
71 GURL url(data.url()); 71 GURL url(data.url());
72 if (url.SchemeIs(extensions::kExtensionScheme)) { 72 if (url.SchemeIs(extensions::kExtensionScheme)) {
73 const std::string& extension_id = url.host(); 73 const std::string& extension_id = url.host();
74 template_url->set_extension_info(make_scoped_ptr( 74 template_url->set_extension_info(make_scoped_ptr(
75 new TemplateURL::AssociatedExtensionInfo( 75 new TemplateURL::AssociatedExtensionInfo(
76 TemplateURL::OMNIBOX_API_EXTENSION, extension_id))); 76 TemplateURL::OMNIBOX_API_EXTENSION, extension_id)));
77 } 77 }
78 } 78 }
79 79
80 void ChromeTemplateURLServiceClient::Observe( 80 void ChromeTemplateURLServiceClient::Observe(
81 int type, 81 int type,
82 const content::NotificationSource& source, 82 const content::NotificationSource& source,
83 const content::NotificationDetails& details) { 83 const content::NotificationDetails& details) {
84 DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URL_VISITED); 84 DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URL_VISITED);
85 85
86 if (!owner_) 86 if (!owner_)
87 return; 87 return;
88 88
89 content::Details<history::URLVisitedDetails> history_details(details); 89 content::Details<history::URLVisitedDetails> history_details(details);
90 TemplateURLService::URLVisitedDetails visited_details; 90 TemplateURLService::URLVisitedDetails visited_details;
91 visited_details.url = history_details->row.url(); 91 visited_details.url = history_details->row.url();
92 visited_details.is_keyword_transition = 92 visited_details.is_keyword_transition =
93 content::PageTransitionStripQualifier(history_details->transition) == 93 ui::PageTransitionStripQualifier(history_details->transition) ==
94 content::PAGE_TRANSITION_KEYWORD; 94 ui::PAGE_TRANSITION_KEYWORD;
95 owner_->OnHistoryURLVisited(visited_details); 95 owner_->OnHistoryURLVisited(visited_details);
96 } 96 }
OLDNEW
« no previous file with comments | « chrome/browser/search/search_unittest.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698