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

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

Issue 1169223002: [Extensions] Clean up the handling of ExtensionHostMsg_Request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 6 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 "chrome/browser/extensions/chrome_extension_function_details.h" 7 #include "chrome/browser/extensions/chrome_extension_function_details.h"
8 #include "chrome/browser/extensions/window_controller.h" 8 #include "chrome/browser/extensions/window_controller.h"
9 #include "chrome/browser/extensions/window_controller_list.h" 9 #include "chrome/browser/extensions/window_controller_list.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 30 matching lines...) Expand all
41 41
42 return GetProfile()->HasOffTheRecordProfile() && 42 return GetProfile()->HasOffTheRecordProfile() &&
43 GetProfile()->GetOffTheRecordProfile() == window_controller->profile(); 43 GetProfile()->GetOffTheRecordProfile() == window_controller->profile();
44 } 44 }
45 45
46 // TODO(stevenjb): Replace this with GetExtensionWindowController(). 46 // TODO(stevenjb): Replace this with GetExtensionWindowController().
47 Browser* ChromeUIThreadExtensionFunction::GetCurrentBrowser() { 47 Browser* ChromeUIThreadExtensionFunction::GetCurrentBrowser() {
48 // If the delegate has an associated browser, return it. 48 // If the delegate has an associated browser, return it.
49 if (dispatcher()) { 49 if (dispatcher()) {
50 extensions::WindowController* window_controller = 50 extensions::WindowController* window_controller =
51 dispatcher()->delegate()->GetExtensionWindowController(); 51 dispatcher()->GetExtensionWindowController();
52 if (window_controller) { 52 if (window_controller) {
53 Browser* browser = window_controller->GetBrowser(); 53 Browser* browser = window_controller->GetBrowser();
54 if (browser) 54 if (browser)
55 return browser; 55 return browser;
56 } 56 }
57 } 57 }
58 58
59 // Otherwise, try to default to a reasonable browser. If |include_incognito_| 59 // Otherwise, try to default to a reasonable browser. If |include_incognito_|
60 // is true, we will also search browsers in the incognito version of this 60 // is true, we will also search browsers in the incognito version of this
61 // profile. Note that the profile may already be incognito, in which case 61 // profile. Note that the profile may already be incognito, in which case
(...skipping 18 matching lines...) Expand all
80 // TODO(rafaelw): Delay creation of background_page until the browser 80 // TODO(rafaelw): Delay creation of background_page until the browser
81 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 81 // is available. http://code.google.com/p/chromium/issues/detail?id=13284
82 return NULL; 82 return NULL;
83 } 83 }
84 84
85 extensions::WindowController* 85 extensions::WindowController*
86 ChromeUIThreadExtensionFunction::GetExtensionWindowController() { 86 ChromeUIThreadExtensionFunction::GetExtensionWindowController() {
87 // If the delegate has an associated window controller, return it. 87 // If the delegate has an associated window controller, return it.
88 if (dispatcher()) { 88 if (dispatcher()) {
89 extensions::WindowController* window_controller = 89 extensions::WindowController* window_controller =
90 dispatcher()->delegate()->GetExtensionWindowController(); 90 dispatcher()->GetExtensionWindowController();
91 if (window_controller) 91 if (window_controller)
92 return window_controller; 92 return window_controller;
93 } 93 }
94 94
95 return extensions::WindowControllerList::GetInstance() 95 return extensions::WindowControllerList::GetInstance()
96 ->CurrentWindowForFunction(ChromeExtensionFunctionDetails(this)); 96 ->CurrentWindowForFunction(ChromeExtensionFunctionDetails(this));
97 } 97 }
98 98
99 content::WebContents* 99 content::WebContents*
100 ChromeUIThreadExtensionFunction::GetAssociatedWebContents() { 100 ChromeUIThreadExtensionFunction::GetAssociatedWebContents() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 ExtensionFunction::ResponseAction ChromeSyncExtensionFunction::Run() { 135 ExtensionFunction::ResponseAction ChromeSyncExtensionFunction::Run() {
136 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); 136 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_));
137 } 137 }
138 138
139 // static 139 // static
140 bool ChromeSyncExtensionFunction::ValidationFailure( 140 bool ChromeSyncExtensionFunction::ValidationFailure(
141 ChromeSyncExtensionFunction* function) { 141 ChromeSyncExtensionFunction* function) {
142 return false; 142 return false;
143 } 143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698