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

Side by Side Diff: chrome/browser/autocomplete/extension_app_provider.h

Issue 6758031: Implement a simple Extension App Omnibox provider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 //
6 // This file contains the Extension App autocomplete provider. The provider
7 // is responsible for keeping track of which Extension Apps are installed and
8 // their URLs. An instance of it gets created and managed by the autocomplete
9 // controller.
10 //
11 // For more information on the autocomplete system in general, including how
12 // the autocomplete controller and autocomplete providers work, see
13 // chrome/browser/autocomplete.h.
14
15 #ifndef CHROME_BROWSER_AUTOCOMPLETE_EXTENSION_APP_PROVIDER_H_
16 #define CHROME_BROWSER_AUTOCOMPLETE_EXTENSION_APP_PROVIDER_H_
17 #pragma once
18
19 #include <string>
20 #include <utility>
21 #include <vector>
22
23 #include "chrome/browser/autocomplete/autocomplete.h"
24 #include "content/common/notification_observer.h"
25 #include "content/common/notification_registrar.h"
26 #include "base/compiler_specific.h"
27
28 class TemplateURLModel;
29
30 class ExtensionAppProvider : public AutocompleteProvider,
31 public NotificationObserver {
32 public:
33 ExtensionAppProvider(ACProviderListener* listener, Profile* profile);
34 // For testing.
35 ExtensionAppProvider(ACProviderListener* listener, TemplateURLModel* model);
36
37 // AutocompleteProvider implementation:
38 virtual void Start(const AutocompleteInput& input,
39 bool minimal_changes) OVERRIDE;
40 virtual void Stop() OVERRIDE;
41
42 private:
43 // An ExtensionApp is a pair of Extension Name and the Launch URL.
44 typedef std::pair<std::string, std::string> ExtensionApp;
45
46 virtual ~ExtensionAppProvider();
47
48 // Fetch the current app list and cache it locally.
49 void RefreshAppList();
50
51 // Register for install/uninstall notification so we can update our cache.
52 void RegisterForNotifications();
53
54 // Calculate the relevance of the match.
55 static int CalculateRelevance(AutocompleteInput::Type type,
56 bool complete,
57 bool matches_name);
58
59 // NotificationObserver implementation:
60 virtual void Observe(NotificationType type,
61 const NotificationSource& source,
62 const NotificationDetails& details) OVERRIDE;
63
64 NotificationRegistrar registrar_;
65
66 // Our cache of ExtensionApp objects (name + url) representing the extension
67 // apps we know about.
68 std::vector<ExtensionApp> extension_apps_;
Peter Kasting 2011/03/31 21:33:59 Nit: Make this a typedef also (ExtensionApps).
Finnur 2011/04/01 15:49:36 Done.
69
70 DISALLOW_COPY_AND_ASSIGN(ExtensionAppProvider);
71 };
72
73 #endif // CHROME_BROWSER_AUTOCOMPLETE_EXTENSION_APP_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698