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

Side by Side Diff: chrome/browser/extensions/extension_service.h

Issue 22944002: Implementation of the "Redirect URLs to Packaged Apps" feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 1) Fixed broken redirection for in-page WebKit-initiated navigations. All redirections work now. 2)… Created 7 years, 4 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 20 matching lines...) Expand all
31 #include "chrome/browser/extensions/menu_manager.h" 31 #include "chrome/browser/extensions/menu_manager.h"
32 #include "chrome/browser/extensions/pending_extension_manager.h" 32 #include "chrome/browser/extensions/pending_extension_manager.h"
33 #include "chrome/browser/extensions/process_map.h" 33 #include "chrome/browser/extensions/process_map.h"
34 #include "chrome/browser/extensions/update_observer.h" 34 #include "chrome/browser/extensions/update_observer.h"
35 #include "chrome/common/extensions/extension.h" 35 #include "chrome/common/extensions/extension.h"
36 #include "chrome/common/extensions/extension_constants.h" 36 #include "chrome/common/extensions/extension_constants.h"
37 #include "chrome/common/extensions/extension_set.h" 37 #include "chrome/common/extensions/extension_set.h"
38 #include "chrome/common/extensions/manifest.h" 38 #include "chrome/common/extensions/manifest.h"
39 #include "content/public/browser/notification_observer.h" 39 #include "content/public/browser/notification_observer.h"
40 #include "content/public/browser/notification_registrar.h" 40 #include "content/public/browser/notification_registrar.h"
41 #include "ipc/ipc_listener.h"
41 #include "sync/api/string_ordinal.h" 42 #include "sync/api/string_ordinal.h"
42 #include "sync/api/sync_change.h" 43 #include "sync/api/sync_change.h"
43 #include "sync/api/syncable_service.h" 44 #include "sync/api/syncable_service.h"
44 45
45 class CommandLine; 46 class CommandLine;
46 class ExtensionErrorUI; 47 class ExtensionErrorUI;
47 class ExtensionSyncData; 48 class ExtensionSyncData;
48 class ExtensionToolbarModel; 49 class ExtensionToolbarModel;
49 class GURL; 50 class GURL;
50 class Profile; 51 class Profile;
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 402
402 // Returns true if |url| should get extension api bindings and be permitted 403 // Returns true if |url| should get extension api bindings and be permitted
403 // to make api calls. Note that this is independent of what extension 404 // to make api calls. Note that this is independent of what extension
404 // permissions the given extension has been granted. 405 // permissions the given extension has been granted.
405 bool ExtensionBindingsAllowed(const GURL& url); 406 bool ExtensionBindingsAllowed(const GURL& url);
406 407
407 // Returns true if a normal browser window should avoid showing |url| in a 408 // Returns true if a normal browser window should avoid showing |url| in a
408 // tab. In this case, |url| is also rewritten to an error URL. 409 // tab. In this case, |url| is also rewritten to an error URL.
409 bool ShouldBlockUrlInBrowserTab(GURL* url); 410 bool ShouldBlockUrlInBrowserTab(GURL* url);
410 411
412 // Looks if there is a platform app that's registered itself for handling
413 // a URL pattern(s) that matches |url|. If there is, launches the app, using
414 // the onLaunched event with |url|, |referrerUrl| and the just found
415 // handler ID as launch parameters, and returns true.
416 // Otherwise, returns false.
417 // This way of redirecting URLs is for use in browser-initiated that happen
418 // in the browser process.
419 bool MaybeRedirectUrlToApp(const GURL& url, const GURL& referrer_url);
420
421 // Launches an app with |app_id|, via an onLaunched event with |handler_id|,
422 // |url| and |referrerUrl| as launch parameters. This is registered to listen
423 // to the respective IPC control message from a renderer process to provide
424 // a way of redirecting URLs for navigations initiated within a
425 // renderer (e.g. WebKit-initiated).
426 bool RedirectUrlToApp(const std::string& app_id,
427 const std::string& handler_id,
428 const GURL& url,
429 const GURL& referrer_url);
430
411 // Called when the initial extensions load has completed. 431 // Called when the initial extensions load has completed.
412 virtual void OnLoadedInstalledExtensions(); 432 virtual void OnLoadedInstalledExtensions();
413 433
414 // Adds |extension| to this ExtensionService and notifies observers that the 434 // Adds |extension| to this ExtensionService and notifies observers that the
415 // extensions have been loaded. 435 // extensions have been loaded.
416 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE; 436 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE;
417 437
418 // Check if we have preferences for the component extension and, if not or if 438 // Check if we have preferences for the component extension and, if not or if
419 // the stored version differs, install the extension (without requirements 439 // the stored version differs, install the extension (without requirements
420 // checking) before calling AddExtension. 440 // checking) before calling AddExtension.
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 ObserverList<extensions::UpdateObserver, true> update_observers_; 1008 ObserverList<extensions::UpdateObserver, true> update_observers_;
989 1009
990 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 1010 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
991 InstallAppsWithUnlimtedStorage); 1011 InstallAppsWithUnlimtedStorage);
992 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 1012 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
993 InstallAppsAndCheckStorageProtection); 1013 InstallAppsAndCheckStorageProtection);
994 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 1014 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
995 }; 1015 };
996 1016
997 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 1017 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698