OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension_dom_ui.h" | 5 #include "chrome/browser/extensions/extension_dom_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 int request_id, | 169 int request_id, |
170 bool has_callback) { | 170 bool has_callback) { |
171 extension_function_dispatcher_->HandleRequest(message, | 171 extension_function_dispatcher_->HandleRequest(message, |
172 content, | 172 content, |
173 source_url, | 173 source_url, |
174 request_id, | 174 request_id, |
175 has_callback); | 175 has_callback); |
176 } | 176 } |
177 | 177 |
178 Browser* ExtensionDOMUI::GetBrowser() const { | 178 Browser* ExtensionDOMUI::GetBrowser() const { |
179 // TODO(beng): This is an improper direct dependency on Browser. Route this | 179 Browser* browser = NULL; |
180 // through some sort of delegate. | 180 TabContentsDelegate* tab_contents_delegate = tab_contents()->delegate(); |
181 return BrowserList::FindBrowserWithProfile(DOMUI::GetProfile()); | 181 if (tab_contents_delegate) |
| 182 browser = tab_contents_delegate->GetBrowser(); |
| 183 |
| 184 return browser; |
182 } | 185 } |
183 | 186 |
184 Profile* ExtensionDOMUI::GetProfile() { | 187 Profile* ExtensionDOMUI::GetProfile() { |
185 return DOMUI::GetProfile(); | 188 return DOMUI::GetProfile(); |
186 } | 189 } |
187 | 190 |
188 gfx::NativeWindow ExtensionDOMUI::GetCustomFrameNativeWindow() { | 191 gfx::NativeWindow ExtensionDOMUI::GetCustomFrameNativeWindow() { |
189 if (GetBrowser()) | 192 if (GetBrowser()) |
190 return NULL; | 193 return NULL; |
191 | 194 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 384 } |
382 | 385 |
383 // static | 386 // static |
384 void ExtensionDOMUI::GetFaviconForURL(Profile* profile, | 387 void ExtensionDOMUI::GetFaviconForURL(Profile* profile, |
385 FaviconService::GetFaviconRequest* request, const GURL& page_url) { | 388 FaviconService::GetFaviconRequest* request, const GURL& page_url) { |
386 // tracker deletes itself when done. | 389 // tracker deletes itself when done. |
387 ExtensionDOMUIImageLoadingTracker* tracker = | 390 ExtensionDOMUIImageLoadingTracker* tracker = |
388 new ExtensionDOMUIImageLoadingTracker(profile, request, page_url); | 391 new ExtensionDOMUIImageLoadingTracker(profile, request, page_url); |
389 tracker->Init(); | 392 tracker->Init(); |
390 } | 393 } |
OLD | NEW |