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

Side by Side Diff: chrome/browser/extensions/api/runtime/runtime_api.cc

Issue 10082019: Have LazyBackgroundTaskQueue notify consumers when the transient page fails to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yoyo Created 8 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_event_router.cc » ('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/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"
11 #include "chrome/browser/extensions/extension_system.h" 11 #include "chrome/browser/extensions/extension_system.h"
12 #include "chrome/browser/extensions/lazy_background_task_queue.h" 12 #include "chrome/browser/extensions/lazy_background_task_queue.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 15
16 namespace { 16 namespace {
17 17
18 const char kOnInstalledEvent[] = "experimental.runtime.onInstalled"; 18 const char kOnInstalledEvent[] = "experimental.runtime.onInstalled";
19 const char kNoBackgroundPageError[] = "You do not have a background page."; 19 const char kNoBackgroundPageError[] = "You do not have a background page.";
20 const char kPageLoadError[] = "Background page failed to load.";
20 21
21 } 22 }
22 23
23 namespace extensions { 24 namespace extensions {
24 25
25 // static 26 // static
26 void RuntimeEventRouter::DispatchOnInstalledEvent( 27 void RuntimeEventRouter::DispatchOnInstalledEvent(
27 Profile* profile, const Extension* extension) { 28 Profile* profile, const Extension* extension) {
28 // Special case: normally, extensions add their own lazy event listeners. 29 // Special case: normally, extensions add their own lazy event listeners.
29 // However, since the extension has just been installed, it hasn't had a 30 // However, since the extension has just been installed, it hasn't had a
(...skipping 19 matching lines...) Expand all
49 base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded, 50 base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded,
50 this)); 51 this));
51 } else { 52 } else {
52 error_ = kNoBackgroundPageError; 53 error_ = kNoBackgroundPageError;
53 return false; 54 return false;
54 } 55 }
55 56
56 return true; 57 return true;
57 } 58 }
58 59
59 void RuntimeGetBackgroundPageFunction::OnPageLoaded(ExtensionHost*) { 60 void RuntimeGetBackgroundPageFunction::OnPageLoaded(ExtensionHost* host) {
60 SendResponse(true); 61 if (host) {
62 SendResponse(true);
63 } else {
64 error_ = kPageLoadError;
65 SendResponse(false);
66 }
61 } 67 }
62 68
63 } // namespace extensions 69 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698