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

Side by Side Diff: chrome/browser/extensions/chrome_extension_function.cc

Issue 1880933002: Begin to enable extension APIs in Extension Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 4 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chrome_extension_function.h" 5 #include "chrome/browser/extensions/chrome_extension_function.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "chrome/browser/extensions/chrome_extension_function_details.h" 9 #include "chrome/browser/extensions/chrome_extension_function_details.h"
10 #include "chrome/browser/extensions/window_controller.h" 10 #include "chrome/browser/extensions/window_controller.h"
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 // Otherwise, try to default to a reasonable browser. If |include_incognito_| 43 // Otherwise, try to default to a reasonable browser. If |include_incognito_|
44 // is true, we will also search browsers in the incognito version of this 44 // is true, we will also search browsers in the incognito version of this
45 // profile. Note that the profile may already be incognito, in which case 45 // profile. Note that the profile may already be incognito, in which case
46 // we will search the incognito version only, regardless of the value of 46 // we will search the incognito version only, regardless of the value of
47 // |include_incognito|. Look only for browsers on the active desktop as it is 47 // |include_incognito|. Look only for browsers on the active desktop as it is
48 // preferable to pretend no browser is open then to return a browser on 48 // preferable to pretend no browser is open then to return a browser on
49 // another desktop. 49 // another desktop.
50 content::WebContents* web_contents = GetSenderWebContents(); 50 content::WebContents* web_contents = GetSenderWebContents();
51 if (web_contents) { 51 Profile* profile = Profile::FromBrowserContext(
52 Profile* profile = 52 web_contents ? web_contents->GetBrowserContext() : browser_context());
53 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 53 Browser* browser = chrome::FindAnyBrowser(profile, include_incognito_);
54 Browser* browser = chrome::FindAnyBrowser(profile, include_incognito_); 54 if (browser)
55 if (browser) 55 return browser;
56 return browser;
57 }
58 56
59 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, 57 // NOTE(rafaelw): This can return NULL in some circumstances. In particular,
60 // a background_page onload chrome.tabs api call can make it into here 58 // a background_page onload chrome.tabs api call can make it into here
61 // before the browser is sufficiently initialized to return here, or 59 // before the browser is sufficiently initialized to return here, or
62 // all of this profile's browser windows may have been closed. 60 // all of this profile's browser windows may have been closed.
63 // A similar situation may arise during shutdown. 61 // A similar situation may arise during shutdown.
64 // TODO(rafaelw): Delay creation of background_page until the browser 62 // TODO(rafaelw): Delay creation of background_page until the browser
65 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 63 // is available. http://code.google.com/p/chromium/issues/detail?id=13284
66 return NULL; 64 return NULL;
67 } 65 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 ExtensionFunction::ResponseAction ChromeSyncExtensionFunction::Run() { 117 ExtensionFunction::ResponseAction ChromeSyncExtensionFunction::Run() {
120 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) 118 return RespondNow(RunSync() ? ArgumentList(std::move(results_))
121 : Error(error_)); 119 : Error(error_));
122 } 120 }
123 121
124 // static 122 // static
125 bool ChromeSyncExtensionFunction::ValidationFailure( 123 bool ChromeSyncExtensionFunction::ValidationFailure(
126 ChromeSyncExtensionFunction* function) { 124 ChromeSyncExtensionFunction* function) {
127 return false; 125 return false;
128 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698