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

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: compile 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
« no previous file with comments | « no previous file | chrome/browser/extensions/active_tab_permission_manager.h » ('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 (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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 if (template_url->IsExtensionKeyword()) { 562 if (template_url->IsExtensionKeyword()) {
563 AutocompleteMatch current_match; 563 AutocompleteMatch current_match;
564 GetInfoForCurrentText(&current_match, NULL); 564 GetInfoForCurrentText(&current_match, NULL);
565 565
566 const AutocompleteMatch& match = 566 const AutocompleteMatch& match =
567 (index == AutocompletePopupModel::kNoMatch) ? 567 (index == AutocompletePopupModel::kNoMatch) ?
568 current_match : result().match_at(index); 568 current_match : result().match_at(index);
569 569
570 // Strip the keyword + leading space off the input. 570 // Strip the keyword + leading space off the input.
571 size_t prefix_length = match.keyword.length() + 1; 571 size_t prefix_length = match.keyword.length() + 1;
572 extensions::ExtensionOmniboxEventRouter::OnInputEntered(profile_, 572 extensions::ExtensionOmniboxEventRouter::OnInputEntered(
573 controller_->GetTabContents(),
573 template_url->GetExtensionId(), 574 template_url->GetExtensionId(),
574 UTF16ToUTF8(match.fill_into_edit.substr(prefix_length))); 575 UTF16ToUTF8(match.fill_into_edit.substr(prefix_length)));
575 view_->RevertAll(); 576 view_->RevertAll();
576 return; 577 return;
577 } 578 }
578 579
579 content::RecordAction(UserMetricsAction("AcceptedKeyword")); 580 content::RecordAction(UserMetricsAction("AcceptedKeyword"));
580 TemplateURLServiceFactory::GetForProfile(profile_)->IncrementUsageCount( 581 TemplateURLServiceFactory::GetForProfile(profile_)->IncrementUsageCount(
581 template_url); 582 template_url);
582 } else { 583 } else {
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 return metrics::OmniboxEventProto_PageClassification_INVALID_SPEC; 1153 return metrics::OmniboxEventProto_PageClassification_INVALID_SPEC;
1153 const std::string& url = gurl.spec(); 1154 const std::string& url = gurl.spec();
1154 if (url == chrome::kChromeUINewTabURL) 1155 if (url == chrome::kChromeUINewTabURL)
1155 return metrics::OmniboxEventProto_PageClassification_NEW_TAB_PAGE; 1156 return metrics::OmniboxEventProto_PageClassification_NEW_TAB_PAGE;
1156 if (url == chrome::kAboutBlankURL) 1157 if (url == chrome::kAboutBlankURL)
1157 return metrics::OmniboxEventProto_PageClassification_BLANK; 1158 return metrics::OmniboxEventProto_PageClassification_BLANK;
1158 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage)) 1159 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage))
1159 return metrics::OmniboxEventProto_PageClassification_HOMEPAGE; 1160 return metrics::OmniboxEventProto_PageClassification_HOMEPAGE;
1160 return metrics::OmniboxEventProto_PageClassification_OTHER; 1161 return metrics::OmniboxEventProto_PageClassification_OTHER;
1161 } 1162 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/active_tab_permission_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698