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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit.cc

Issue 10535155: Hook the activeTab permission up to the omnibox, page action, and context menu APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/autocomplete/autocomplete_edit.h" 5 #include "chrome/browser/autocomplete/autocomplete_edit.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 if (template_url->IsExtensionKeyword()) { 561 if (template_url->IsExtensionKeyword()) {
562 AutocompleteMatch current_match; 562 AutocompleteMatch current_match;
563 GetInfoForCurrentText(&current_match, NULL); 563 GetInfoForCurrentText(&current_match, NULL);
564 564
565 const AutocompleteMatch& match = 565 const AutocompleteMatch& match =
566 (index == AutocompletePopupModel::kNoMatch) ? 566 (index == AutocompletePopupModel::kNoMatch) ?
567 current_match : result().match_at(index); 567 current_match : result().match_at(index);
568 568
569 // Strip the keyword + leading space off the input. 569 // Strip the keyword + leading space off the input.
570 size_t prefix_length = match.keyword.length() + 1; 570 size_t prefix_length = match.keyword.length() + 1;
571 extensions::ExtensionOmniboxEventRouter::OnInputEntered(profile_, 571 extensions::ExtensionOmniboxEventRouter::OnInputEntered(
572 controller_->GetTabContents(),
572 template_url->GetExtensionId(), 573 template_url->GetExtensionId(),
573 UTF16ToUTF8(match.fill_into_edit.substr(prefix_length))); 574 UTF16ToUTF8(match.fill_into_edit.substr(prefix_length)));
574 view_->RevertAll(); 575 view_->RevertAll();
575 return; 576 return;
576 } 577 }
577 578
578 content::RecordAction(UserMetricsAction("AcceptedKeyword")); 579 content::RecordAction(UserMetricsAction("AcceptedKeyword"));
579 TemplateURLServiceFactory::GetForProfile(profile_)->IncrementUsageCount( 580 TemplateURLServiceFactory::GetForProfile(profile_)->IncrementUsageCount(
580 template_url); 581 template_url);
581 } else { 582 } else {
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 return metrics::OmniboxEventProto_PageClassification_INVALID_SPEC; 1152 return metrics::OmniboxEventProto_PageClassification_INVALID_SPEC;
1152 const std::string& url = gurl.spec(); 1153 const std::string& url = gurl.spec();
1153 if (url == chrome::kChromeUINewTabURL) 1154 if (url == chrome::kChromeUINewTabURL)
1154 return metrics::OmniboxEventProto_PageClassification_NEW_TAB_PAGE; 1155 return metrics::OmniboxEventProto_PageClassification_NEW_TAB_PAGE;
1155 if (url == chrome::kAboutBlankURL) 1156 if (url == chrome::kAboutBlankURL)
1156 return metrics::OmniboxEventProto_PageClassification_BLANK; 1157 return metrics::OmniboxEventProto_PageClassification_BLANK;
1157 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage)) 1158 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage))
1158 return metrics::OmniboxEventProto_PageClassification_HOMEPAGE; 1159 return metrics::OmniboxEventProto_PageClassification_HOMEPAGE;
1159 return metrics::OmniboxEventProto_PageClassification_OTHER; 1160 return metrics::OmniboxEventProto_PageClassification_OTHER;
1160 } 1161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698