mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add "url" command-line option to cefclient (issue #715).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@770 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -421,7 +421,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
CefBrowser::CreateBrowserSync(window_info,
|
CefBrowser::CreateBrowserSync(window_info,
|
||||||
static_cast<CefRefPtr<CefClient> >(g_handler),
|
static_cast<CefRefPtr<CefClient> >(g_handler),
|
||||||
"http://www.google.com", browserSettings);
|
g_handler->GetStartupURL(), browserSettings);
|
||||||
|
|
||||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||||
gtk_widget_show_all(GTK_WIDGET(window));
|
gtk_widget_show_all(GTK_WIDGET(window));
|
||||||
|
@@ -393,7 +393,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
|
|
||||||
window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight);
|
window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight);
|
||||||
CefBrowser::CreateBrowser(window_info, g_handler.get(),
|
CefBrowser::CreateBrowser(window_info, g_handler.get(),
|
||||||
"http://www.google.com", settings);
|
g_handler->GetStartupURL(), settings);
|
||||||
|
|
||||||
// Show the window.
|
// Show the window.
|
||||||
[mainWnd makeKeyAndOrderFront: nil];
|
[mainWnd makeKeyAndOrderFront: nil];
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
namespace cefclient {
|
namespace cefclient {
|
||||||
|
|
||||||
|
const char kUrl[] = "url";
|
||||||
|
|
||||||
// CefSettings attributes.
|
// CefSettings attributes.
|
||||||
const char kMultiThreadedMessageLoop[] = "multi-threaded-message-loop";
|
const char kMultiThreadedMessageLoop[] = "multi-threaded-message-loop";
|
||||||
const char kCachePath[] = "cache-path";
|
const char kCachePath[] = "cache-path";
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
namespace cefclient {
|
namespace cefclient {
|
||||||
|
|
||||||
|
extern const char kUrl[];
|
||||||
|
|
||||||
// CefSettings attributes.
|
// CefSettings attributes.
|
||||||
extern const char kMultiThreadedMessageLoop[];
|
extern const char kMultiThreadedMessageLoop[];
|
||||||
extern const char kCachePath[];
|
extern const char kCachePath[];
|
||||||
|
@@ -350,7 +350,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||||||
// Creat the new child browser window
|
// Creat the new child browser window
|
||||||
CefBrowser::CreateBrowser(info,
|
CefBrowser::CreateBrowser(info,
|
||||||
static_cast<CefRefPtr<CefClient> >(g_handler),
|
static_cast<CefRefPtr<CefClient> >(g_handler),
|
||||||
"http://www.google.com", settings);
|
g_handler->GetStartupURL(), settings);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -7,13 +7,14 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
|
#include "include/cef_command_line.h"
|
||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "cefclient/binding_test.h"
|
#include "cefclient/binding_test.h"
|
||||||
#include "cefclient/cefclient.h"
|
#include "cefclient/cefclient.h"
|
||||||
|
#include "cefclient/cefclient_switches.h"
|
||||||
#include "cefclient/download_handler.h"
|
#include "cefclient/download_handler.h"
|
||||||
#include "cefclient/string_util.h"
|
#include "cefclient/string_util.h"
|
||||||
|
|
||||||
|
|
||||||
ClientHandler::ClientHandler()
|
ClientHandler::ClientHandler()
|
||||||
: m_MainHwnd(NULL),
|
: m_MainHwnd(NULL),
|
||||||
m_BrowserHwnd(NULL),
|
m_BrowserHwnd(NULL),
|
||||||
@@ -23,6 +24,13 @@ ClientHandler::ClientHandler()
|
|||||||
m_StopHwnd(NULL),
|
m_StopHwnd(NULL),
|
||||||
m_ReloadHwnd(NULL),
|
m_ReloadHwnd(NULL),
|
||||||
m_bFormElementHasFocus(false) {
|
m_bFormElementHasFocus(false) {
|
||||||
|
CefRefPtr<CefCommandLine> commandLine = AppGetCommandLine();
|
||||||
|
if (commandLine.get()) {
|
||||||
|
if (commandLine->HasSwitch(cefclient::kUrl))
|
||||||
|
m_StartupURL = commandLine->GetSwitchValue(cefclient::kUrl);
|
||||||
|
else
|
||||||
|
m_StartupURL = "http://www.google.com/";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientHandler::~ClientHandler() {
|
ClientHandler::~ClientHandler() {
|
||||||
|
@@ -181,6 +181,8 @@ class ClientHandler : public CefClient,
|
|||||||
|
|
||||||
std::string GetLogFile();
|
std::string GetLogFile();
|
||||||
|
|
||||||
|
std::string GetStartupURL() const { return m_StartupURL; }
|
||||||
|
|
||||||
void SetLastDownloadFile(const std::string& fileName);
|
void SetLastDownloadFile(const std::string& fileName);
|
||||||
std::string GetLastDownloadFile();
|
std::string GetLastDownloadFile();
|
||||||
|
|
||||||
@@ -233,6 +235,9 @@ class ClientHandler : public CefClient,
|
|||||||
// True if a form element currently has focus
|
// True if a form element currently has focus
|
||||||
bool m_bFormElementHasFocus;
|
bool m_bFormElementHasFocus;
|
||||||
|
|
||||||
|
// The URL to be loaded at application startup.
|
||||||
|
std::string m_StartupURL;
|
||||||
|
|
||||||
// Include the default reference counting implementation.
|
// Include the default reference counting implementation.
|
||||||
IMPLEMENT_REFCOUNTING(ClientHandler);
|
IMPLEMENT_REFCOUNTING(ClientHandler);
|
||||||
// Include the default locking implementation.
|
// Include the default locking implementation.
|
||||||
|
Reference in New Issue
Block a user