diff options
Diffstat (limited to 'chrome/browser/tab_contents/background_contents.cc')
-rw-r--r-- | chrome/browser/tab_contents/background_contents.cc | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc index ee459e1..5121d29 100644 --- a/chrome/browser/tab_contents/background_contents.cc +++ b/chrome/browser/tab_contents/background_contents.cc @@ -10,6 +10,7 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/site_instance.h" #include "chrome/browser/renderer_preferences_util.h" +#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/notification_service.h" #include "chrome/common/url_constants.h" #include "chrome/common/view_types.h" @@ -46,23 +47,6 @@ BackgroundContents::BackgroundContents() render_view_host_(NULL) { } -void BackgroundContents::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - // TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent - // background pages are closed when the last referencing frame is closed. - switch (type.value) { - case NotificationType::PROFILE_DESTROYED: - case NotificationType::APP_TERMINATING: { - delete this; - break; - } - default: - NOTREACHED() << "Unexpected notification sent."; - break; - } -} - BackgroundContents::~BackgroundContents() { if (!render_view_host_) // Will be null for unit tests. return; @@ -74,6 +58,14 @@ BackgroundContents::~BackgroundContents() { render_view_host_->Shutdown(); // deletes render_view_host } +ViewType::Type BackgroundContents::GetRenderViewType() const { + return ViewType::BACKGROUND_CONTENTS; +} + +int BackgroundContents::GetBrowserWindowID() const { + return extension_misc::kUnknownWindowId; +} + void BackgroundContents::DidNavigate( RenderViewHost* render_view_host, const ViewHostMsg_FrameNavigate_Params& params) { @@ -109,9 +101,27 @@ void BackgroundContents::RunJavaScriptMessage( *did_suppress_message = true; } -gfx::NativeWindow BackgroundContents::GetMessageBoxRootWindow() { - NOTIMPLEMENTED(); - return NULL; +bool BackgroundContents::PreHandleKeyboardEvent( + const NativeWebKeyboardEvent& event, + bool* is_keyboard_shortcut) { + return false; +} + +void BackgroundContents::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + // TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent + // background pages are closed when the last referencing frame is closed. + switch (type.value) { + case NotificationType::PROFILE_DESTROYED: + case NotificationType::APP_TERMINATING: { + delete this; + break; + } + default: + NOTREACHED() << "Unexpected notification sent."; + break; + } } void BackgroundContents::OnMessageBoxClosed(IPC::Message* reply_msg, @@ -120,6 +130,11 @@ void BackgroundContents::OnMessageBoxClosed(IPC::Message* reply_msg, render_view_host_->JavaScriptMessageBoxClosed(reply_msg, success, prompt); } +gfx::NativeWindow BackgroundContents::GetMessageBoxRootWindow() { + NOTIMPLEMENTED(); + return NULL; +} + void BackgroundContents::Close(RenderViewHost* render_view_host) { Profile* profile = render_view_host->process()->profile(); NotificationService::current()->Notify( |