OLD | NEW |
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/window_controller.h" | 8 #include "chrome/browser/extensions/window_controller.h" |
8 #include "chrome/browser/extensions/window_controller_list.h" | 9 #include "chrome/browser/extensions/window_controller_list.h" |
9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
14 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
15 #include "extensions/browser/extension_function_dispatcher.h" | 16 #include "extensions/browser/extension_function_dispatcher.h" |
16 | 17 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 ChromeUIThreadExtensionFunction::GetExtensionWindowController() { | 86 ChromeUIThreadExtensionFunction::GetExtensionWindowController() { |
86 // If the delegate has an associated window controller, return it. | 87 // If the delegate has an associated window controller, return it. |
87 if (dispatcher()) { | 88 if (dispatcher()) { |
88 extensions::WindowController* window_controller = | 89 extensions::WindowController* window_controller = |
89 dispatcher()->delegate()->GetExtensionWindowController(); | 90 dispatcher()->delegate()->GetExtensionWindowController(); |
90 if (window_controller) | 91 if (window_controller) |
91 return window_controller; | 92 return window_controller; |
92 } | 93 } |
93 | 94 |
94 return extensions::WindowControllerList::GetInstance() | 95 return extensions::WindowControllerList::GetInstance() |
95 ->CurrentWindowForFunction(this); | 96 ->CurrentWindowForFunction(ChromeExtensionFunctionDetails(this)); |
96 } | 97 } |
97 | 98 |
98 content::WebContents* | 99 content::WebContents* |
99 ChromeUIThreadExtensionFunction::GetAssociatedWebContents() { | 100 ChromeUIThreadExtensionFunction::GetAssociatedWebContents() { |
100 content::WebContents* web_contents = | 101 content::WebContents* web_contents = |
101 UIThreadExtensionFunction::GetAssociatedWebContents(); | 102 UIThreadExtensionFunction::GetAssociatedWebContents(); |
102 if (web_contents) | 103 if (web_contents) |
103 return web_contents; | 104 return web_contents; |
104 | 105 |
105 Browser* browser = GetCurrentBrowser(); | 106 Browser* browser = GetCurrentBrowser(); |
(...skipping 27 matching lines...) Expand all Loading... |
133 | 134 |
134 ExtensionFunction::ResponseAction ChromeSyncExtensionFunction::Run() { | 135 ExtensionFunction::ResponseAction ChromeSyncExtensionFunction::Run() { |
135 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); | 136 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); |
136 } | 137 } |
137 | 138 |
138 // static | 139 // static |
139 bool ChromeSyncExtensionFunction::ValidationFailure( | 140 bool ChromeSyncExtensionFunction::ValidationFailure( |
140 ChromeSyncExtensionFunction* function) { | 141 ChromeSyncExtensionFunction* function) { |
141 return false; | 142 return false; |
142 } | 143 } |
OLD | NEW |