diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-06-12 17:34:38 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-06-12 17:38:05 +0200 |
commit | 30d205d5663ab0baeb571d80f1e4d27981d5b4a1 (patch) | |
tree | e43566e2243899707f9fb0821dba5d2afe651461 /lib/web_contents_delegate_qt.cpp | |
parent | 0f0c301265d0acd2ea15769b0930eb4054e54a3d (diff) |
Quick cleanup.
Diffstat (limited to 'lib/web_contents_delegate_qt.cpp')
-rw-r--r-- | lib/web_contents_delegate_qt.cpp | 56 |
1 files changed, 3 insertions, 53 deletions
diff --git a/lib/web_contents_delegate_qt.cpp b/lib/web_contents_delegate_qt.cpp index db470c7e4..71f3e6d9c 100644 --- a/lib/web_contents_delegate_qt.cpp +++ b/lib/web_contents_delegate_qt.cpp @@ -41,42 +41,23 @@ #include "web_contents_delegate_qt.h" +#include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" -#include "content/public/browser/navigation_controller.h" +#include "content/public/common/renderer_preferences.h" -#include "web_contents_view_qt.h" -#include "qwebcontentsview.h" -#include "qquickwebcontentsview.h" - -#include <QWidget> -#include <QVBoxLayout> -#include <QToolButton> -#include <QLineEdit> -#include <QQuickView> #include <QGuiApplication> #include <QStyleHints> static const int kTestWindowWidth = 800; static const int kTestWindowHeight = 600; -std::vector<WebContentsDelegateQt*> WebContentsDelegateQt::m_windows; - WebContentsDelegateQt::WebContentsDelegateQt(content::WebContents* web_contents) : m_webContents(web_contents) { m_webContents->SetDelegate(this); - // const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - // registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, - // Source<WebContents>(web_contents)); - m_windows.push_back(this); - - // if (!shell_created_callback_.is_null()) { - // shell_created_callback_.Run(this); - // shell_created_callback_.Reset(); - // } } -WebContentsDelegateQt* WebContentsDelegateQt::CreateNewWindow(content::BrowserContext* browser_context, const GURL& url, content::SiteInstance* site_instance, int routing_id, const gfx::Size& initial_size) +WebContentsDelegateQt* WebContentsDelegateQt::CreateNewWindow(content::BrowserContext* browser_context, content::SiteInstance* site_instance, int routing_id, const gfx::Size& initial_size) { content::WebContents::CreateParams create_params(browser_context, site_instance); create_params.routing_id = routing_id; @@ -95,8 +76,6 @@ WebContentsDelegateQt* WebContentsDelegateQt::CreateNewWindow(content::BrowserCo rendererPrefs->caret_blink_interval = 0.5 * static_cast<double>(qtCursorFlashTime) / 1000; delegate->m_webContents->GetRenderViewHost()->SyncRendererPrefs(); - if (!url.is_empty()) - delegate->LoadURL(url); return delegate; } @@ -105,35 +84,6 @@ content::WebContents* WebContentsDelegateQt::web_contents() return m_webContents.get(); } - -void WebContentsDelegateQt::GoBackOrForward(int offset) { - m_webContents->GetController().GoToOffset(offset); - m_webContents->GetView()->Focus(); -} - -void WebContentsDelegateQt::Reload() { - m_webContents->GetController().Reload(false); - m_webContents->GetView()->Focus(); -} - -void WebContentsDelegateQt::Stop() { - m_webContents->Stop(); - m_webContents->GetView()->Focus(); -} - -void WebContentsDelegateQt::LoadURL(const GURL& url) -{ - LoadURLForFrame(url, std::string()); -} - -void WebContentsDelegateQt::LoadURLForFrame(const GURL& url, const std::string& frame_name) { - content::NavigationController::LoadURLParams params(url); - params.transition_type = content::PageTransitionFromInt(content::PAGE_TRANSITION_TYPED | content::PAGE_TRANSITION_FROM_ADDRESS_BAR); - params.frame_name = frame_name; - m_webContents->GetController().LoadURLWithParams(params); - m_webContents->GetView()->Focus(); -} - void WebContentsDelegateQt::Observe(int, const content::NotificationSource&, const content::NotificationDetails&) { // IMPLEMENT THIS!!!! |