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/extensions/api/runtime/runtime_api.cc

Issue 10804020: Introduce runtime.onSuspendCanceled() event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos call Created 8 years, 5 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/extensions/api/runtime/runtime_api.h" 5 #include "chrome/browser/extensions/api/runtime/runtime_api.h"
6 6
7 #include "chrome/common/extensions/extension.h" 7 #include "chrome/common/extensions/extension.h"
8 #include "chrome/browser/extensions/extension_event_router.h" 8 #include "chrome/browser/extensions/extension_event_router.h"
9 #include "chrome/browser/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_process_manager.h" 10 #include "chrome/browser/extensions/extension_process_manager.h"
(...skipping 23 matching lines...) Expand all
34 // However, since the extension has just been installed, it hasn't had a 34 // However, since the extension has just been installed, it hasn't had a
35 // chance to register for events. So we register on its behalf. If the 35 // chance to register for events. So we register on its behalf. If the
36 // extension does not actually have a listener, the event will just be 36 // extension does not actually have a listener, the event will just be
37 // ignored. 37 // ignored.
38 system->event_router()->AddLazyEventListener(kOnInstalledEvent, extension_id); 38 system->event_router()->AddLazyEventListener(kOnInstalledEvent, extension_id);
39 system->event_router()->DispatchEventToExtension( 39 system->event_router()->DispatchEventToExtension(
40 extension_id, kOnInstalledEvent, "[]", NULL, GURL()); 40 extension_id, kOnInstalledEvent, "[]", NULL, GURL());
41 } 41 }
42 42
43 bool RuntimeGetBackgroundPageFunction::RunImpl() { 43 bool RuntimeGetBackgroundPageFunction::RunImpl() {
44 ExtensionHost* host = 44 ExtensionSystem::Get(profile())->lazy_background_task_queue()->
45 ExtensionSystem::Get(profile())->process_manager()-> 45 AddPendingTask(
46 GetBackgroundHostForExtension(extension_id()); 46 profile(), extension_id(),
47 if (host) { 47 base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded,
48 OnPageLoaded(host); 48 this));
49 } else if (GetExtension()->has_lazy_background_page()) {
50 ExtensionSystem::Get(profile())->lazy_background_task_queue()->
51 AddPendingTask(
52 profile(), extension_id(),
53 base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded,
54 this));
55 } else {
56 error_ = kNoBackgroundPageError;
Matt Perry 2012/07/24 19:25:15 We lost this error in the transition. Could you ad
57 return false;
58 }
59 49
60 return true; 50 return true;
61 } 51 }
62 52
63 void RuntimeGetBackgroundPageFunction::OnPageLoaded(ExtensionHost* host) { 53 void RuntimeGetBackgroundPageFunction::OnPageLoaded(ExtensionHost* host) {
64 if (host) { 54 if (host) {
65 SendResponse(true); 55 SendResponse(true);
66 } else { 56 } else {
67 error_ = kPageLoadError; 57 error_ = kPageLoadError;
68 SendResponse(false); 58 SendResponse(false);
69 } 59 }
70 } 60 }
71 61
72 } // namespace extensions 62 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698