| 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_view.h" | 5 #include "chrome/browser/extensions/extension_view.h" |
| 6 | 6 |
| 7 #include "base/string_piece.h" |
| 7 #include "chrome/browser/renderer_host/render_view_host.h" | 8 #include "chrome/browser/renderer_host/render_view_host.h" |
| 9 #include "chrome/common/resource_bundle.h" |
| 10 #include "grit/browser_resources.h" |
| 11 #include "grit/generated_resources.h" |
| 8 | 12 |
| 9 ExtensionView::ExtensionView(const GURL& url, Profile* profile) : | 13 ExtensionView::ExtensionView(const GURL& url, Profile* profile) : |
| 10 HWNDHtmlView(url, this, false), profile_(profile) { | 14 HWNDHtmlView(url, this, false), profile_(profile) { |
| 11 // TODO(mpcomplete): query this from the renderer somehow? | 15 // TODO(mpcomplete): query this from the renderer somehow? |
| 12 set_preferred_size(gfx::Size(100, 100)); | 16 set_preferred_size(gfx::Size(100, 100)); |
| 13 } | 17 } |
| 14 | 18 |
| 15 void ExtensionView::CreatingRenderer() { | 19 void ExtensionView::CreatingRenderer() { |
| 16 render_view_host()->AllowExtensionBindings(); | 20 render_view_host()->AllowExtensionBindings(); |
| 17 } | 21 } |
| 18 | 22 |
| 19 WebPreferences ExtensionView::GetWebkitPrefs() { | 23 WebPreferences ExtensionView::GetWebkitPrefs() { |
| 20 // TODO(mpcomplete): return some reasonable prefs. | 24 // TODO(mpcomplete): return some reasonable prefs. |
| 21 return WebPreferences(); | 25 return WebPreferences(); |
| 22 } | 26 } |
| 23 | 27 |
| 24 void ExtensionView::RunJavaScriptMessage( | 28 void ExtensionView::RunJavaScriptMessage( |
| 25 const std::wstring& message, | 29 const std::wstring& message, |
| 26 const std::wstring& default_prompt, | 30 const std::wstring& default_prompt, |
| 27 const GURL& frame_url, | 31 const GURL& frame_url, |
| 28 const int flags, | 32 const int flags, |
| 29 IPC::Message* reply_msg, | 33 IPC::Message* reply_msg, |
| 30 bool* did_suppress_message) { | 34 bool* did_suppress_message) { |
| 31 // Automatically cancel the javascript alert (otherwise the renderer hangs | 35 // Automatically cancel the javascript alert (otherwise the renderer hangs |
| 32 // indefinitely). | 36 // indefinitely). |
| 33 *did_suppress_message = true; | 37 *did_suppress_message = true; |
| 34 render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, L""); | 38 render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, L""); |
| 35 } | 39 } |
| 40 |
| 41 void ExtensionView::DidStartLoading(RenderViewHost* render_view_host, |
| 42 int32 page_id) { |
| 43 static const StringPiece toolstrip_css( |
| 44 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 45 IDR_EXTENSIONS_TOOLSTRIP_CSS)); |
| 46 render_view_host->InsertCSSInWebFrame(L"", toolstrip_css.as_string()); |
| 47 } |
| OLD | NEW |