| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/extensions/extension.h" | 9 #include "chrome/browser/extensions/extension.h" |
| 10 #include "chrome/browser/extensions/extension_message_service.h" | 10 #include "chrome/browser/extensions/extension_message_service.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 const GURL& frame_url, | 71 const GURL& frame_url, |
| 72 const int flags, | 72 const int flags, |
| 73 IPC::Message* reply_msg, | 73 IPC::Message* reply_msg, |
| 74 bool* did_suppress_message) { | 74 bool* did_suppress_message) { |
| 75 // Automatically cancel the javascript alert (otherwise the renderer hangs | 75 // Automatically cancel the javascript alert (otherwise the renderer hangs |
| 76 // indefinitely). | 76 // indefinitely). |
| 77 *did_suppress_message = true; | 77 *did_suppress_message = true; |
| 78 render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, L""); | 78 render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, L""); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void ExtensionHost::DidStartLoading(RenderViewHost* render_view_host) { | 81 void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) { |
| 82 // TODO(aa): This is toolstrip-specific and should probably not be here. |
| 83 // ExtensionToolstrip in bookmark_bar_view.cc? |
| 82 static const StringPiece toolstrip_css( | 84 static const StringPiece toolstrip_css( |
| 83 ResourceBundle::GetSharedInstance().GetRawDataResource( | 85 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 84 IDR_EXTENSIONS_TOOLSTRIP_CSS)); | 86 IDR_EXTENSIONS_TOOLSTRIP_CSS)); |
| 85 render_view_host->InsertCSSInWebFrame(L"", toolstrip_css.as_string()); | 87 render_view_host->InsertCSSInWebFrame(L"", toolstrip_css.as_string()); |
| 86 } | |
| 87 | 88 |
| 88 void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) { | |
| 89 render_view_host->WasResized(); | 89 render_view_host->WasResized(); |
| 90 did_stop_loading_ = true; | 90 did_stop_loading_ = true; |
| 91 |
| 91 if (view_) | 92 if (view_) |
| 92 view_->ShowIfCompletelyLoaded(); | 93 view_->ShowIfCompletelyLoaded(); |
| 93 } | 94 } |
| 94 | 95 |
| 95 ExtensionFunctionDispatcher* ExtensionHost:: | 96 ExtensionFunctionDispatcher* ExtensionHost:: |
| 96 CreateExtensionFunctionDispatcher(RenderViewHost *render_view_host, | 97 CreateExtensionFunctionDispatcher(RenderViewHost *render_view_host, |
| 97 const std::string& extension_id) { | 98 const std::string& extension_id) { |
| 98 return new ExtensionFunctionDispatcher(render_view_host, GetBrowser(), | 99 return new ExtensionFunctionDispatcher(render_view_host, GetBrowser(), |
| 99 extension_id); | 100 extension_id); |
| 100 } | 101 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 Browser* ExtensionHost::GetBrowser() { | 163 Browser* ExtensionHost::GetBrowser() { |
| 163 if (view_) | 164 if (view_) |
| 164 return view_->browser(); | 165 return view_->browser(); |
| 165 Browser* browser = BrowserList::FindBrowserWithProfile( | 166 Browser* browser = BrowserList::FindBrowserWithProfile( |
| 166 render_view_host()->process()->profile()); | 167 render_view_host()->process()->profile()); |
| 167 // TODO(mpcomplete): what this verifies doesn't actually happen yet. | 168 // TODO(mpcomplete): what this verifies doesn't actually happen yet. |
| 168 CHECK(browser) << "ExtensionHost running in Profile with no Browser active." | 169 CHECK(browser) << "ExtensionHost running in Profile with no Browser active." |
| 169 " It should have been deleted."; | 170 " It should have been deleted."; |
| 170 return browser; | 171 return browser; |
| 171 } | 172 } |
| OLD | NEW |