cefclient: Fix member variable naming to match Chromium style.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1768 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
6702fc573a
commit
c260a2d166
|
@ -27,10 +27,10 @@ CefRefPtr<CefBrowser> AppGetBrowser() {
|
|||
return g_handler->GetBrowser();
|
||||
}
|
||||
|
||||
ClientWindowHandle AppGetMainHwnd() {
|
||||
ClientWindowHandle AppGetMainWindowHandle() {
|
||||
if (!g_handler.get())
|
||||
return kNullWindowHandle;
|
||||
return g_handler->GetMainHwnd();
|
||||
return g_handler->GetMainWindowHandle();
|
||||
}
|
||||
|
||||
void AppInitCommandLine(int argc, const char* const* argv) {
|
||||
|
|
|
@ -19,7 +19,7 @@ class CefCommandLine;
|
|||
CefRefPtr<CefBrowser> AppGetBrowser();
|
||||
|
||||
// Returns the main application window handle.
|
||||
ClientWindowHandle AppGetMainHwnd();
|
||||
ClientWindowHandle AppGetMainWindowHandle();
|
||||
|
||||
// Returns the application working directory.
|
||||
std::string AppGetWorkingDirectory();
|
||||
|
|
|
@ -413,10 +413,10 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
// Create the handler.
|
||||
g_handler = new ClientHandler();
|
||||
g_handler->SetMainHwnd(vbox);
|
||||
g_handler->SetEditHwnd(entry);
|
||||
g_handler->SetButtonHwnds(GTK_WIDGET(back), GTK_WIDGET(forward),
|
||||
GTK_WIDGET(reload), GTK_WIDGET(stop));
|
||||
g_handler->SetMainWindowHandle(vbox);
|
||||
g_handler->SetEditWindowHandle(entry);
|
||||
g_handler->SetButtonWindowHandles(GTK_WIDGET(back), GTK_WIDGET(forward),
|
||||
GTK_WIDGET(reload), GTK_WIDGET(stop));
|
||||
|
||||
CefWindowInfo window_info;
|
||||
CefBrowserSettings browserSettings;
|
||||
|
|
|
@ -447,8 +447,8 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||
|
||||
// Create the handler.
|
||||
g_handler = new ClientHandler();
|
||||
g_handler->SetMainHwnd(contentView);
|
||||
g_handler->SetEditHwnd(editWnd);
|
||||
g_handler->SetMainWindowHandle(contentView);
|
||||
g_handler->SetEditWindowHandle(editWnd);
|
||||
|
||||
// Create the browser view.
|
||||
CefWindowInfo window_info;
|
||||
|
|
|
@ -332,7 +332,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||
case WM_CREATE: {
|
||||
// Create the single static handler class instance
|
||||
g_handler = new ClientHandler();
|
||||
g_handler->SetMainHwnd(hWnd);
|
||||
g_handler->SetMainWindowHandle(hWnd);
|
||||
|
||||
// Create the child windows used for navigation
|
||||
RECT rect;
|
||||
|
@ -378,8 +378,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||
reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
|
||||
SetWindowLongPtr(editWnd, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG_PTR>(WndProc));
|
||||
g_handler->SetEditHwnd(editWnd);
|
||||
g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd);
|
||||
g_handler->SetEditWindowHandle(editWnd);
|
||||
g_handler->SetButtonWindowHandles(
|
||||
backWnd, forwardWnd, reloadWnd, stopWnd);
|
||||
|
||||
rect.top += URLBAR_HEIGHT;
|
||||
|
||||
|
|
|
@ -86,18 +86,18 @@ bool ParseTestUrl(const std::string& url,
|
|||
|
||||
} // namespace
|
||||
|
||||
int ClientHandler::m_BrowserCount = 0;
|
||||
int ClientHandler::browser_count_ = 0;
|
||||
|
||||
ClientHandler::ClientHandler()
|
||||
: m_MainHwnd(NULL),
|
||||
m_BrowserId(0),
|
||||
m_bIsClosing(false),
|
||||
m_EditHwnd(NULL),
|
||||
m_BackHwnd(NULL),
|
||||
m_ForwardHwnd(NULL),
|
||||
m_StopHwnd(NULL),
|
||||
m_ReloadHwnd(NULL),
|
||||
m_bFocusOnEditableField(false) {
|
||||
: main_handle_(NULL),
|
||||
browser_id_(0),
|
||||
is_closing_(false),
|
||||
edit_handle_(NULL),
|
||||
back_handle_(NULL),
|
||||
forward_handle_(NULL),
|
||||
stop_handle_(NULL),
|
||||
reload_handle_(NULL),
|
||||
focus_on_editable_field_(false) {
|
||||
#if defined(OS_LINUX)
|
||||
gtk_dialog_ = NULL;
|
||||
#endif
|
||||
|
@ -107,11 +107,11 @@ ClientHandler::ClientHandler()
|
|||
CefCommandLine::GetGlobalCommandLine();
|
||||
|
||||
if (command_line->HasSwitch(cefclient::kUrl))
|
||||
m_StartupURL = command_line->GetSwitchValue(cefclient::kUrl);
|
||||
if (m_StartupURL.empty())
|
||||
m_StartupURL = "http://www.google.com/";
|
||||
startup_url_ = command_line->GetSwitchValue(cefclient::kUrl);
|
||||
if (startup_url_.empty())
|
||||
startup_url_ = "http://www.google.com/";
|
||||
|
||||
m_bMouseCursorChangeDisabled =
|
||||
mouse_cursor_change_disabled_ =
|
||||
command_line->HasSwitch(cefclient::kMouseCursorChangeDisabled);
|
||||
}
|
||||
|
||||
|
@ -131,10 +131,10 @@ bool ClientHandler::OnProcessMessageReceived(
|
|||
std::string message_name = message->GetName();
|
||||
if (message_name == client_renderer::kFocusedNodeChangedMessage) {
|
||||
// A message is sent from ClientRenderDelegate to tell us whether the
|
||||
// currently focused DOM node is editable. Use of |m_bFocusOnEditableField|
|
||||
// currently focused DOM node is editable. Use of |focus_on_editable_field_|
|
||||
// is redundant with CefKeyEvent.focus_on_editable_field in OnPreKeyEvent
|
||||
// but is useful for demonstration purposes.
|
||||
m_bFocusOnEditableField = message->GetArgumentList()->GetBool(0);
|
||||
focus_on_editable_field_ = message->GetArgumentList()->GetBool(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
|||
{
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
first_message = m_LogFile.empty();
|
||||
first_message = log_file_.empty();
|
||||
if (first_message) {
|
||||
std::stringstream ss;
|
||||
ss << AppGetWorkingDirectory();
|
||||
|
@ -213,9 +213,9 @@ bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
|||
ss << "/";
|
||||
#endif
|
||||
ss << "console.log";
|
||||
m_LogFile = ss.str();
|
||||
log_file_ = ss.str();
|
||||
}
|
||||
logFile = m_LogFile;
|
||||
logFile = log_file_;
|
||||
}
|
||||
|
||||
FILE* file = fopen(logFile.c_str(), "a");
|
||||
|
@ -355,17 +355,17 @@ void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
|||
}
|
||||
|
||||
// Disable mouse cursor change if requested via the command-line flag.
|
||||
if (m_bMouseCursorChangeDisabled)
|
||||
if (mouse_cursor_change_disabled_)
|
||||
browser->GetHost()->SetMouseCursorChangeDisabled(true);
|
||||
|
||||
AutoLock lock_scope(this);
|
||||
if (!m_Browser.get()) {
|
||||
if (!browser_.get()) {
|
||||
// We need to keep the main child window, but not popup windows
|
||||
m_Browser = browser;
|
||||
m_BrowserId = browser->GetIdentifier();
|
||||
browser_ = browser;
|
||||
browser_id_ = browser->GetIdentifier();
|
||||
} else if (browser->IsPopup()) {
|
||||
// Add to the list of popup browsers.
|
||||
m_PopupBrowsers.push_back(browser);
|
||||
popup_browsers_.push_back(browser);
|
||||
|
||||
// Give focus to the popup browser. Perform asynchronously because the
|
||||
// parent window may attempt to keep focus after launching the popup.
|
||||
|
@ -374,7 +374,7 @@ void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
|||
&CefBrowserHost::SetFocus, true));
|
||||
}
|
||||
|
||||
m_BrowserCount++;
|
||||
browser_count_++;
|
||||
}
|
||||
|
||||
bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
||||
|
@ -383,9 +383,9 @@ bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
|||
// Closing the main window requires special handling. See the DoClose()
|
||||
// documentation in the CEF header for a detailed destription of this
|
||||
// process.
|
||||
if (m_BrowserId == browser->GetIdentifier()) {
|
||||
if (browser_id_ == browser->GetIdentifier()) {
|
||||
// Set a flag to indicate that the window close should be allowed.
|
||||
m_bIsClosing = true;
|
||||
is_closing_ = true;
|
||||
}
|
||||
|
||||
// Allow the close. For windowed browsers this will result in the OS close
|
||||
|
@ -398,26 +398,26 @@ void ClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
|||
|
||||
message_router_->OnBeforeClose(browser);
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier()) {
|
||||
if (browser_id_ == browser->GetIdentifier()) {
|
||||
// Free the browser pointer so that the browser can be destroyed
|
||||
m_Browser = NULL;
|
||||
browser_ = NULL;
|
||||
|
||||
if (m_OSRHandler.get()) {
|
||||
m_OSRHandler->OnBeforeClose(browser);
|
||||
m_OSRHandler = NULL;
|
||||
if (osr_handler_.get()) {
|
||||
osr_handler_->OnBeforeClose(browser);
|
||||
osr_handler_ = NULL;
|
||||
}
|
||||
} else if (browser->IsPopup()) {
|
||||
// Remove from the browser popup list.
|
||||
BrowserList::iterator bit = m_PopupBrowsers.begin();
|
||||
for (; bit != m_PopupBrowsers.end(); ++bit) {
|
||||
BrowserList::iterator bit = popup_browsers_.begin();
|
||||
for (; bit != popup_browsers_.end(); ++bit) {
|
||||
if ((*bit)->IsSame(browser)) {
|
||||
m_PopupBrowsers.erase(bit);
|
||||
popup_browsers_.erase(bit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (--m_BrowserCount == 0) {
|
||||
if (--browser_count_ == 0) {
|
||||
// All browser windows have closed.
|
||||
// Remove and delete message router handlers.
|
||||
MessageHandlerSet::const_iterator it = message_handler_set_.begin();
|
||||
|
@ -558,15 +558,15 @@ void ClientHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
|||
|
||||
bool ClientHandler::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||
CefRect& rect) {
|
||||
if (!m_OSRHandler.get())
|
||||
if (!osr_handler_.get())
|
||||
return false;
|
||||
return m_OSRHandler->GetRootScreenRect(browser, rect);
|
||||
return osr_handler_->GetRootScreenRect(browser, rect);
|
||||
}
|
||||
|
||||
bool ClientHandler::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) {
|
||||
if (!m_OSRHandler.get())
|
||||
if (!osr_handler_.get())
|
||||
return false;
|
||||
return m_OSRHandler->GetViewRect(browser, rect);
|
||||
return osr_handler_->GetViewRect(browser, rect);
|
||||
}
|
||||
|
||||
bool ClientHandler::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||
|
@ -574,30 +574,30 @@ bool ClientHandler::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
|||
int viewY,
|
||||
int& screenX,
|
||||
int& screenY) {
|
||||
if (!m_OSRHandler.get())
|
||||
if (!osr_handler_.get())
|
||||
return false;
|
||||
return m_OSRHandler->GetScreenPoint(browser, viewX, viewY, screenX, screenY);
|
||||
return osr_handler_->GetScreenPoint(browser, viewX, viewY, screenX, screenY);
|
||||
}
|
||||
|
||||
bool ClientHandler::GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
||||
CefScreenInfo& screen_info) {
|
||||
if (!m_OSRHandler.get())
|
||||
if (!osr_handler_.get())
|
||||
return false;
|
||||
return m_OSRHandler->GetScreenInfo(browser, screen_info);
|
||||
return osr_handler_->GetScreenInfo(browser, screen_info);
|
||||
}
|
||||
|
||||
void ClientHandler::OnPopupShow(CefRefPtr<CefBrowser> browser,
|
||||
bool show) {
|
||||
if (!m_OSRHandler.get())
|
||||
if (!osr_handler_.get())
|
||||
return;
|
||||
return m_OSRHandler->OnPopupShow(browser, show);
|
||||
return osr_handler_->OnPopupShow(browser, show);
|
||||
}
|
||||
|
||||
void ClientHandler::OnPopupSize(CefRefPtr<CefBrowser> browser,
|
||||
const CefRect& rect) {
|
||||
if (!m_OSRHandler.get())
|
||||
if (!osr_handler_.get())
|
||||
return;
|
||||
return m_OSRHandler->OnPopupSize(browser, rect);
|
||||
return osr_handler_->OnPopupSize(browser, rect);
|
||||
}
|
||||
|
||||
void ClientHandler::OnPaint(CefRefPtr<CefBrowser> browser,
|
||||
|
@ -606,53 +606,53 @@ void ClientHandler::OnPaint(CefRefPtr<CefBrowser> browser,
|
|||
const void* buffer,
|
||||
int width,
|
||||
int height) {
|
||||
if (!m_OSRHandler.get())
|
||||
if (!osr_handler_.get())
|
||||
return;
|
||||
m_OSRHandler->OnPaint(browser, type, dirtyRects, buffer, width, height);
|
||||
osr_handler_->OnPaint(browser, type, dirtyRects, buffer, width, height);
|
||||
}
|
||||
|
||||
void ClientHandler::OnCursorChange(CefRefPtr<CefBrowser> browser,
|
||||
CefCursorHandle cursor) {
|
||||
if (!m_OSRHandler.get())
|
||||
if (!osr_handler_.get())
|
||||
return;
|
||||
m_OSRHandler->OnCursorChange(browser, cursor);
|
||||
osr_handler_->OnCursorChange(browser, cursor);
|
||||
}
|
||||
|
||||
bool ClientHandler::StartDragging(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDragData> drag_data,
|
||||
CefRenderHandler::DragOperationsMask allowed_ops,
|
||||
int x, int y) {
|
||||
if (!m_OSRHandler.get())
|
||||
if (!osr_handler_.get())
|
||||
return false;
|
||||
return m_OSRHandler->StartDragging(browser, drag_data, allowed_ops, x, y);
|
||||
return osr_handler_->StartDragging(browser, drag_data, allowed_ops, x, y);
|
||||
}
|
||||
|
||||
void ClientHandler::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
|
||||
CefRenderHandler::DragOperation operation) {
|
||||
if (!m_OSRHandler.get())
|
||||
if (!osr_handler_.get())
|
||||
return;
|
||||
m_OSRHandler->UpdateDragCursor(browser, operation);
|
||||
osr_handler_->UpdateDragCursor(browser, operation);
|
||||
}
|
||||
|
||||
void ClientHandler::SetMainHwnd(ClientWindowHandle hwnd) {
|
||||
void ClientHandler::SetMainWindowHandle(ClientWindowHandle handle) {
|
||||
AutoLock lock_scope(this);
|
||||
m_MainHwnd = hwnd;
|
||||
main_handle_ = handle;
|
||||
}
|
||||
|
||||
void ClientHandler::SetEditHwnd(ClientWindowHandle hwnd) {
|
||||
void ClientHandler::SetEditWindowHandle(ClientWindowHandle handle) {
|
||||
AutoLock lock_scope(this);
|
||||
m_EditHwnd = hwnd;
|
||||
edit_handle_ = handle;
|
||||
}
|
||||
|
||||
void ClientHandler::SetButtonHwnds(ClientWindowHandle backHwnd,
|
||||
ClientWindowHandle forwardHwnd,
|
||||
ClientWindowHandle reloadHwnd,
|
||||
ClientWindowHandle stopHwnd) {
|
||||
void ClientHandler::SetButtonWindowHandles(ClientWindowHandle backHandle,
|
||||
ClientWindowHandle forwardHandle,
|
||||
ClientWindowHandle reloadHandle,
|
||||
ClientWindowHandle stopHandle) {
|
||||
AutoLock lock_scope(this);
|
||||
m_BackHwnd = backHwnd;
|
||||
m_ForwardHwnd = forwardHwnd;
|
||||
m_ReloadHwnd = reloadHwnd;
|
||||
m_StopHwnd = stopHwnd;
|
||||
back_handle_ = backHandle;
|
||||
forward_handle_ = forwardHandle;
|
||||
reload_handle_ = reloadHandle;
|
||||
stop_handle_ = stopHandle;
|
||||
}
|
||||
|
||||
void ClientHandler::CloseAllBrowsers(bool force_close) {
|
||||
|
@ -664,32 +664,32 @@ void ClientHandler::CloseAllBrowsers(bool force_close) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!m_PopupBrowsers.empty()) {
|
||||
if (!popup_browsers_.empty()) {
|
||||
// Request that any popup browsers close.
|
||||
BrowserList::const_iterator it = m_PopupBrowsers.begin();
|
||||
for (; it != m_PopupBrowsers.end(); ++it)
|
||||
BrowserList::const_iterator it = popup_browsers_.begin();
|
||||
for (; it != popup_browsers_.end(); ++it)
|
||||
(*it)->GetHost()->CloseBrowser(force_close);
|
||||
}
|
||||
|
||||
if (m_Browser.get()) {
|
||||
if (browser_.get()) {
|
||||
// Request that the main browser close.
|
||||
m_Browser->GetHost()->CloseBrowser(force_close);
|
||||
browser_->GetHost()->CloseBrowser(force_close);
|
||||
}
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetLogFile() {
|
||||
AutoLock lock_scope(this);
|
||||
return m_LogFile;
|
||||
return log_file_;
|
||||
}
|
||||
|
||||
void ClientHandler::SetLastDownloadFile(const std::string& fileName) {
|
||||
AutoLock lock_scope(this);
|
||||
m_LastDownloadFile = fileName;
|
||||
last_download_file_ = fileName;
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetLastDownloadFile() {
|
||||
AutoLock lock_scope(this);
|
||||
return m_LastDownloadFile;
|
||||
return last_download_file_;
|
||||
}
|
||||
|
||||
void ClientHandler::ShowDevTools(CefRefPtr<CefBrowser> browser) {
|
||||
|
@ -750,7 +750,8 @@ void ClientHandler::EndTracing() {
|
|||
}
|
||||
}
|
||||
|
||||
virtual void OnEndTracingComplete(const CefString& tracing_file) OVERRIDE {
|
||||
virtual void OnEndTracingComplete(
|
||||
const CefString& tracing_file) OVERRIDE {
|
||||
handler_->SetLastDownloadFile(tracing_file.ToString());
|
||||
handler_->SendNotification(NOTIFY_DOWNLOAD_COMPLETE);
|
||||
}
|
||||
|
@ -808,23 +809,23 @@ void ClientHandler::BuildTestMenu(CefRefPtr<CefMenuModel> model) {
|
|||
submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM3, "Radio Item 3", 0);
|
||||
|
||||
// Check the check item.
|
||||
if (m_TestMenuState.check_item)
|
||||
if (test_menu_state_.check_item)
|
||||
submenu->SetChecked(CLIENT_ID_TESTMENU_CHECKITEM, true);
|
||||
|
||||
// Check the selected radio item.
|
||||
submenu->SetChecked(
|
||||
CLIENT_ID_TESTMENU_RADIOITEM1 + m_TestMenuState.radio_item, true);
|
||||
CLIENT_ID_TESTMENU_RADIOITEM1 + test_menu_state_.radio_item, true);
|
||||
}
|
||||
|
||||
bool ClientHandler::ExecuteTestMenu(int command_id) {
|
||||
if (command_id == CLIENT_ID_TESTMENU_CHECKITEM) {
|
||||
// Toggle the check item.
|
||||
m_TestMenuState.check_item ^= 1;
|
||||
test_menu_state_.check_item ^= 1;
|
||||
return true;
|
||||
} else if (command_id >= CLIENT_ID_TESTMENU_RADIOITEM1 &&
|
||||
command_id <= CLIENT_ID_TESTMENU_RADIOITEM3) {
|
||||
// Store the selected radio item.
|
||||
m_TestMenuState.radio_item = (command_id - CLIENT_ID_TESTMENU_RADIOITEM1);
|
||||
test_menu_state_.radio_item = (command_id - CLIENT_ID_TESTMENU_RADIOITEM1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,20 +244,20 @@ class ClientHandler : public CefClient,
|
|||
CefRenderHandler::DragOperation operation)
|
||||
OVERRIDE;
|
||||
|
||||
void SetMainHwnd(ClientWindowHandle hwnd);
|
||||
ClientWindowHandle GetMainHwnd() { return m_MainHwnd; }
|
||||
void SetEditHwnd(ClientWindowHandle hwnd);
|
||||
void SetMainWindowHandle(ClientWindowHandle handle);
|
||||
ClientWindowHandle GetMainWindowHandle() { return main_handle_; }
|
||||
void SetEditWindowHandle(ClientWindowHandle handle);
|
||||
void SetOSRHandler(CefRefPtr<RenderHandler> handler) {
|
||||
m_OSRHandler = handler;
|
||||
osr_handler_ = handler;
|
||||
}
|
||||
CefRefPtr<RenderHandler> GetOSRHandler() { return m_OSRHandler; }
|
||||
void SetButtonHwnds(ClientWindowHandle backHwnd,
|
||||
ClientWindowHandle forwardHwnd,
|
||||
ClientWindowHandle reloadHwnd,
|
||||
ClientWindowHandle stopHwnd);
|
||||
CefRefPtr<RenderHandler> GetOSRHandler() { return osr_handler_; }
|
||||
void SetButtonWindowHandles(ClientWindowHandle backHandle,
|
||||
ClientWindowHandle forwardHandle,
|
||||
ClientWindowHandle reloadHandle,
|
||||
ClientWindowHandle stopHandle);
|
||||
|
||||
CefRefPtr<CefBrowser> GetBrowser() { return m_Browser; }
|
||||
int GetBrowserId() { return m_BrowserId; }
|
||||
CefRefPtr<CefBrowser> GetBrowser() { return browser_; }
|
||||
int GetBrowserId() { return browser_id_; }
|
||||
|
||||
// Request that all existing browser windows close.
|
||||
void CloseAllBrowsers(bool force_close);
|
||||
|
@ -265,7 +265,7 @@ class ClientHandler : public CefClient,
|
|||
// Returns true if the main browser window is currently closing. Used in
|
||||
// combination with DoClose() and the OS close notification to properly handle
|
||||
// 'onbeforeunload' JavaScript events during window close.
|
||||
bool IsClosing() { return m_bIsClosing; }
|
||||
bool IsClosing() { return is_closing_; }
|
||||
|
||||
std::string GetLogFile();
|
||||
|
||||
|
@ -285,7 +285,7 @@ class ClientHandler : public CefClient,
|
|||
void CloseDevTools(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
// Returns the startup URL.
|
||||
std::string GetStartupURL() { return m_StartupURL; }
|
||||
std::string GetStartupURL() { return startup_url_; }
|
||||
|
||||
void BeginTracing();
|
||||
void EndTracing();
|
||||
|
@ -307,53 +307,53 @@ class ClientHandler : public CefClient,
|
|||
TestMenuState() : check_item(true), radio_item(0) {}
|
||||
bool check_item;
|
||||
int radio_item;
|
||||
} m_TestMenuState;
|
||||
} test_menu_state_;
|
||||
|
||||
// Returns the full download path for the specified file, or an empty path to
|
||||
// use the default temp directory.
|
||||
std::string GetDownloadPath(const std::string& file_name);
|
||||
|
||||
// The child browser window
|
||||
CefRefPtr<CefBrowser> m_Browser;
|
||||
CefRefPtr<CefBrowser> browser_;
|
||||
|
||||
// List of any popup browser windows. Only accessed on the CEF UI thread.
|
||||
typedef std::list<CefRefPtr<CefBrowser> > BrowserList;
|
||||
BrowserList m_PopupBrowsers;
|
||||
BrowserList popup_browsers_;
|
||||
|
||||
// The main frame window handle
|
||||
ClientWindowHandle m_MainHwnd;
|
||||
ClientWindowHandle main_handle_;
|
||||
|
||||
// The child browser id
|
||||
int m_BrowserId;
|
||||
int browser_id_;
|
||||
|
||||
// True if the main browser window is currently closing.
|
||||
bool m_bIsClosing;
|
||||
bool is_closing_;
|
||||
|
||||
// The edit window handle
|
||||
ClientWindowHandle m_EditHwnd;
|
||||
ClientWindowHandle edit_handle_;
|
||||
|
||||
// The button window handles
|
||||
ClientWindowHandle m_BackHwnd;
|
||||
ClientWindowHandle m_ForwardHwnd;
|
||||
ClientWindowHandle m_StopHwnd;
|
||||
ClientWindowHandle m_ReloadHwnd;
|
||||
ClientWindowHandle back_handle_;
|
||||
ClientWindowHandle forward_handle_;
|
||||
ClientWindowHandle stop_handle_;
|
||||
ClientWindowHandle reload_handle_;
|
||||
|
||||
CefRefPtr<RenderHandler> m_OSRHandler;
|
||||
CefRefPtr<RenderHandler> osr_handler_;
|
||||
|
||||
// Support for logging.
|
||||
std::string m_LogFile;
|
||||
std::string log_file_;
|
||||
|
||||
// Support for downloading files.
|
||||
std::string m_LastDownloadFile;
|
||||
std::string last_download_file_;
|
||||
|
||||
// True if an editable field currently has focus.
|
||||
bool m_bFocusOnEditableField;
|
||||
bool focus_on_editable_field_;
|
||||
|
||||
// The startup URL.
|
||||
std::string m_StartupURL;
|
||||
std::string startup_url_;
|
||||
|
||||
// True if mouse cursor change is disabled.
|
||||
bool m_bMouseCursorChangeDisabled;
|
||||
bool mouse_cursor_change_disabled_;
|
||||
|
||||
// Handles the browser side of query routing. The renderer side is handled
|
||||
// in client_renderer.cpp.
|
||||
|
@ -364,7 +364,7 @@ class ClientHandler : public CefClient,
|
|||
|
||||
// Number of currently existing browser windows. The application will exit
|
||||
// when the number of windows reaches 0.
|
||||
static int m_BrowserCount;
|
||||
static int browser_count_;
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
static void OnDialogResponse(GtkDialog *dialog,
|
||||
|
|
|
@ -156,8 +156,8 @@ bool ClientHandler::OnFileDialog(CefRefPtr<CefBrowser> browser,
|
|||
}
|
||||
}
|
||||
|
||||
GtkWidget* window =
|
||||
gtk_widget_get_ancestor(GTK_WIDGET(GetMainHwnd()), GTK_TYPE_WINDOW);
|
||||
GtkWidget* window = gtk_widget_get_ancestor(
|
||||
GTK_WIDGET(GetMainWindowHandle()), GTK_TYPE_WINDOW);
|
||||
GtkWidget* dialog = gtk_file_chooser_dialog_new(
|
||||
title_str.c_str(),
|
||||
GTK_WINDOW(window),
|
||||
|
@ -218,10 +218,10 @@ void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
|||
const CefString& url) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
if (browser_id_ == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// Set the edit window text
|
||||
std::string urlStr(url);
|
||||
gtk_entry_set_text(GTK_ENTRY(m_EditHwnd), urlStr.c_str());
|
||||
gtk_entry_set_text(GTK_ENTRY(edit_handle_), urlStr.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
|||
|
||||
if (!browser->IsPopup()) {
|
||||
// Set the GTK parent window title.
|
||||
GtkWidget* window = gtk_widget_get_ancestor(m_MainHwnd,
|
||||
GtkWidget* window = gtk_widget_get_ancestor(main_handle_,
|
||||
GTK_TYPE_WINDOW);
|
||||
gtk_window_set_title(GTK_WINDOW(window), titleStr.c_str());
|
||||
} else {
|
||||
|
@ -314,8 +314,8 @@ bool ClientHandler::OnJSDialog(CefRefPtr<CefBrowser> browser,
|
|||
title += origin_url.ToString();
|
||||
}
|
||||
|
||||
GtkWidget* window =
|
||||
gtk_widget_get_ancestor(GTK_WIDGET(GetMainHwnd()), GTK_TYPE_WINDOW);
|
||||
GtkWidget* window = gtk_widget_get_ancestor(
|
||||
GTK_WIDGET(GetMainWindowHandle()), GTK_TYPE_WINDOW);
|
||||
gtk_dialog_ = gtk_message_dialog_new(GTK_WINDOW(window),
|
||||
GTK_DIALOG_MODAL,
|
||||
gtk_message_type,
|
||||
|
@ -401,21 +401,21 @@ void ClientHandler::SendNotification(NotificationType type) {
|
|||
|
||||
void ClientHandler::SetLoading(bool isLoading) {
|
||||
if (isLoading)
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), true);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(stop_handle_), true);
|
||||
else
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), false);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(stop_handle_), false);
|
||||
}
|
||||
|
||||
void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
|
||||
if (canGoBack)
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), true);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(back_handle_), true);
|
||||
else
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), false);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(back_handle_), false);
|
||||
|
||||
if (canGoForward)
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), true);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(forward_handle_), true);
|
||||
else
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), false);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(forward_handle_), false);
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetDownloadPath(const std::string& file_name) {
|
||||
|
|
|
@ -14,9 +14,9 @@ void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
|||
const CefString& url) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
if (browser_id_ == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// Set the edit window text
|
||||
NSTextField* textField = (NSTextField*)m_EditHwnd;
|
||||
NSTextField* textField = (NSTextField*)edit_handle_;
|
||||
std::string urlStr(url);
|
||||
NSString* str = [NSString stringWithUTF8String:urlStr.c_str()];
|
||||
[textField setStringValue:str];
|
||||
|
@ -52,7 +52,7 @@ void ClientHandler::SendNotification(NotificationType type) {
|
|||
if (sel == nil)
|
||||
return;
|
||||
|
||||
NSWindow* window = [AppGetMainHwnd() window];
|
||||
NSWindow* window = [AppGetMainWindowHandle() window];
|
||||
NSObject* delegate = [window delegate];
|
||||
[delegate performSelectorOnMainThread:sel withObject:nil waitUntilDone:NO];
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
|||
const CefString& url) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
if (browser_id_ == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// Set the edit window text
|
||||
SetWindowText(m_EditHwnd, std::wstring(url).c_str());
|
||||
SetWindowText(edit_handle_, std::wstring(url).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
|||
|
||||
// Set the frame window title bar
|
||||
CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();
|
||||
if (m_BrowserId == browser->GetIdentifier()) {
|
||||
if (browser_id_ == browser->GetIdentifier()) {
|
||||
// The frame window will be the parent of the browser window
|
||||
hwnd = GetParent(hwnd);
|
||||
}
|
||||
|
@ -51,20 +51,21 @@ void ClientHandler::SendNotification(NotificationType type) {
|
|||
default:
|
||||
return;
|
||||
}
|
||||
PostMessage(m_MainHwnd, WM_COMMAND, id, 0);
|
||||
PostMessage(main_handle_, WM_COMMAND, id, 0);
|
||||
}
|
||||
|
||||
void ClientHandler::SetLoading(bool isLoading) {
|
||||
DCHECK(m_EditHwnd != NULL && m_ReloadHwnd != NULL && m_StopHwnd != NULL);
|
||||
EnableWindow(m_EditHwnd, TRUE);
|
||||
EnableWindow(m_ReloadHwnd, !isLoading);
|
||||
EnableWindow(m_StopHwnd, isLoading);
|
||||
DCHECK(edit_handle_ != NULL && reload_handle_ != NULL &&
|
||||
stop_handle_ != NULL);
|
||||
EnableWindow(edit_handle_, TRUE);
|
||||
EnableWindow(reload_handle_, !isLoading);
|
||||
EnableWindow(stop_handle_, isLoading);
|
||||
}
|
||||
|
||||
void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
|
||||
DCHECK(m_BackHwnd != NULL && m_ForwardHwnd != NULL);
|
||||
EnableWindow(m_BackHwnd, canGoBack);
|
||||
EnableWindow(m_ForwardHwnd, canGoForward);
|
||||
DCHECK(back_handle_ != NULL && forward_handle_ != NULL);
|
||||
EnableWindow(back_handle_, canGoBack);
|
||||
EnableWindow(forward_handle_, canGoForward);
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetDownloadPath(const std::string& file_name) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
std::string AppGetWorkingDirectory() {
|
||||
return std::string();
|
||||
}
|
||||
CefWindowHandle AppGetMainHwnd() {
|
||||
CefWindowHandle AppGetMainWindowHandle() {
|
||||
return NULL;
|
||||
}
|
||||
void AppQuitMessageLoop() {
|
||||
|
|
Loading…
Reference in New Issue