diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-28 17:45:33 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-28 17:45:33 +0000 |
commit | 56ad3797dc8ea7d757dc2b12d606c14cedd564e1 (patch) | |
tree | 26fab7c6d4cbb0358b404ca3eb488aae75ebe1d3 /chrome/browser/search_engines/template_url.cc | |
parent | 79b663c6e6ddf89e85cdc566b5d4f368465bb858 (diff) | |
download | chromium_src-56ad3797dc8ea7d757dc2b12d606c14cedd564e1.zip chromium_src-56ad3797dc8ea7d757dc2b12d606c14cedd564e1.tar.gz chromium_src-56ad3797dc8ea7d757dc2b12d606c14cedd564e1.tar.bz2 |
First pass at experimental omnibox API. There are plenty of rough edges and features to work on, but it's in a usable state.
When an extension is installed that specifies an omnibox keyword in its manifest, we add that keyword to the user's list of Search Engines. The user can then edit this keyword later.
I'm leveraging most of the original search engine keyword code. An extension keyword has a special URL that identifies it as an extension keyword. There is some special case code to treat these keywords slightly differently throughout
the omnibox code.
BUG=38884
Review URL: http://codereview.chromium.org/2078021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48503 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines/template_url.cc')
-rw-r--r-- | chrome/browser/search_engines/template_url.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc index d91bce9..f069a8e 100644 --- a/chrome/browser/search_engines/template_url.cc +++ b/chrome/browser/search_engines/template_url.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,6 +12,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/google_url_tracker.h" #include "chrome/browser/search_engines/template_url_model.h" +#include "chrome/common/url_constants.h" #include "gfx/favicon_size.h" #include "net/base/escape.h" @@ -621,3 +622,12 @@ void TemplateURL::InvalidateCachedValues() const { keyword_generated_ = false; } } + +std::string TemplateURL::GetExtensionId() const { + DCHECK(IsExtensionKeyword()); + return GURL(WideToUTF8(url_.url())).host(); +} + +bool TemplateURL::IsExtensionKeyword() const { + return GURL(WideToUTF8(url_.url())).SchemeIs(chrome::kExtensionScheme); +} |