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:
Marshall Greenblatt 2014-07-11 20:28:37 +00:00
parent 6702fc573a
commit c260a2d166
11 changed files with 155 additions and 152 deletions

View File

@ -27,10 +27,10 @@ CefRefPtr<CefBrowser> AppGetBrowser() {
return g_handler->GetBrowser(); return g_handler->GetBrowser();
} }
ClientWindowHandle AppGetMainHwnd() { ClientWindowHandle AppGetMainWindowHandle() {
if (!g_handler.get()) if (!g_handler.get())
return kNullWindowHandle; return kNullWindowHandle;
return g_handler->GetMainHwnd(); return g_handler->GetMainWindowHandle();
} }
void AppInitCommandLine(int argc, const char* const* argv) { void AppInitCommandLine(int argc, const char* const* argv) {

View File

@ -19,7 +19,7 @@ class CefCommandLine;
CefRefPtr<CefBrowser> AppGetBrowser(); CefRefPtr<CefBrowser> AppGetBrowser();
// Returns the main application window handle. // Returns the main application window handle.
ClientWindowHandle AppGetMainHwnd(); ClientWindowHandle AppGetMainWindowHandle();
// Returns the application working directory. // Returns the application working directory.
std::string AppGetWorkingDirectory(); std::string AppGetWorkingDirectory();

View File

@ -413,10 +413,10 @@ int main(int argc, char* argv[]) {
// Create the handler. // Create the handler.
g_handler = new ClientHandler(); g_handler = new ClientHandler();
g_handler->SetMainHwnd(vbox); g_handler->SetMainWindowHandle(vbox);
g_handler->SetEditHwnd(entry); g_handler->SetEditWindowHandle(entry);
g_handler->SetButtonHwnds(GTK_WIDGET(back), GTK_WIDGET(forward), g_handler->SetButtonWindowHandles(GTK_WIDGET(back), GTK_WIDGET(forward),
GTK_WIDGET(reload), GTK_WIDGET(stop)); GTK_WIDGET(reload), GTK_WIDGET(stop));
CefWindowInfo window_info; CefWindowInfo window_info;
CefBrowserSettings browserSettings; CefBrowserSettings browserSettings;

View File

@ -447,8 +447,8 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
// Create the handler. // Create the handler.
g_handler = new ClientHandler(); g_handler = new ClientHandler();
g_handler->SetMainHwnd(contentView); g_handler->SetMainWindowHandle(contentView);
g_handler->SetEditHwnd(editWnd); g_handler->SetEditWindowHandle(editWnd);
// Create the browser view. // Create the browser view.
CefWindowInfo window_info; CefWindowInfo window_info;

View File

@ -332,7 +332,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
case WM_CREATE: { case WM_CREATE: {
// Create the single static handler class instance // Create the single static handler class instance
g_handler = new ClientHandler(); g_handler = new ClientHandler();
g_handler->SetMainHwnd(hWnd); g_handler->SetMainWindowHandle(hWnd);
// Create the child windows used for navigation // Create the child windows used for navigation
RECT rect; RECT rect;
@ -378,8 +378,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC)); reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
SetWindowLongPtr(editWnd, GWLP_WNDPROC, SetWindowLongPtr(editWnd, GWLP_WNDPROC,
reinterpret_cast<LONG_PTR>(WndProc)); reinterpret_cast<LONG_PTR>(WndProc));
g_handler->SetEditHwnd(editWnd); g_handler->SetEditWindowHandle(editWnd);
g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd); g_handler->SetButtonWindowHandles(
backWnd, forwardWnd, reloadWnd, stopWnd);
rect.top += URLBAR_HEIGHT; rect.top += URLBAR_HEIGHT;

View File

@ -86,18 +86,18 @@ bool ParseTestUrl(const std::string& url,
} // namespace } // namespace
int ClientHandler::m_BrowserCount = 0; int ClientHandler::browser_count_ = 0;
ClientHandler::ClientHandler() ClientHandler::ClientHandler()
: m_MainHwnd(NULL), : main_handle_(NULL),
m_BrowserId(0), browser_id_(0),
m_bIsClosing(false), is_closing_(false),
m_EditHwnd(NULL), edit_handle_(NULL),
m_BackHwnd(NULL), back_handle_(NULL),
m_ForwardHwnd(NULL), forward_handle_(NULL),
m_StopHwnd(NULL), stop_handle_(NULL),
m_ReloadHwnd(NULL), reload_handle_(NULL),
m_bFocusOnEditableField(false) { focus_on_editable_field_(false) {
#if defined(OS_LINUX) #if defined(OS_LINUX)
gtk_dialog_ = NULL; gtk_dialog_ = NULL;
#endif #endif
@ -107,11 +107,11 @@ ClientHandler::ClientHandler()
CefCommandLine::GetGlobalCommandLine(); CefCommandLine::GetGlobalCommandLine();
if (command_line->HasSwitch(cefclient::kUrl)) if (command_line->HasSwitch(cefclient::kUrl))
m_StartupURL = command_line->GetSwitchValue(cefclient::kUrl); startup_url_ = command_line->GetSwitchValue(cefclient::kUrl);
if (m_StartupURL.empty()) if (startup_url_.empty())
m_StartupURL = "http://www.google.com/"; startup_url_ = "http://www.google.com/";
m_bMouseCursorChangeDisabled = mouse_cursor_change_disabled_ =
command_line->HasSwitch(cefclient::kMouseCursorChangeDisabled); command_line->HasSwitch(cefclient::kMouseCursorChangeDisabled);
} }
@ -131,10 +131,10 @@ bool ClientHandler::OnProcessMessageReceived(
std::string message_name = message->GetName(); std::string message_name = message->GetName();
if (message_name == client_renderer::kFocusedNodeChangedMessage) { if (message_name == client_renderer::kFocusedNodeChangedMessage) {
// A message is sent from ClientRenderDelegate to tell us whether the // 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 // is redundant with CefKeyEvent.focus_on_editable_field in OnPreKeyEvent
// but is useful for demonstration purposes. // but is useful for demonstration purposes.
m_bFocusOnEditableField = message->GetArgumentList()->GetBool(0); focus_on_editable_field_ = message->GetArgumentList()->GetBool(0);
return true; return true;
} }
@ -203,7 +203,7 @@ bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
{ {
AutoLock lock_scope(this); AutoLock lock_scope(this);
first_message = m_LogFile.empty(); first_message = log_file_.empty();
if (first_message) { if (first_message) {
std::stringstream ss; std::stringstream ss;
ss << AppGetWorkingDirectory(); ss << AppGetWorkingDirectory();
@ -213,9 +213,9 @@ bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
ss << "/"; ss << "/";
#endif #endif
ss << "console.log"; ss << "console.log";
m_LogFile = ss.str(); log_file_ = ss.str();
} }
logFile = m_LogFile; logFile = log_file_;
} }
FILE* file = fopen(logFile.c_str(), "a"); 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. // Disable mouse cursor change if requested via the command-line flag.
if (m_bMouseCursorChangeDisabled) if (mouse_cursor_change_disabled_)
browser->GetHost()->SetMouseCursorChangeDisabled(true); browser->GetHost()->SetMouseCursorChangeDisabled(true);
AutoLock lock_scope(this); AutoLock lock_scope(this);
if (!m_Browser.get()) { if (!browser_.get()) {
// We need to keep the main child window, but not popup windows // We need to keep the main child window, but not popup windows
m_Browser = browser; browser_ = browser;
m_BrowserId = browser->GetIdentifier(); browser_id_ = browser->GetIdentifier();
} else if (browser->IsPopup()) { } else if (browser->IsPopup()) {
// Add to the list of popup browsers. // 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 // Give focus to the popup browser. Perform asynchronously because the
// parent window may attempt to keep focus after launching the popup. // parent window may attempt to keep focus after launching the popup.
@ -374,7 +374,7 @@ void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
&CefBrowserHost::SetFocus, true)); &CefBrowserHost::SetFocus, true));
} }
m_BrowserCount++; browser_count_++;
} }
bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) { 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() // Closing the main window requires special handling. See the DoClose()
// documentation in the CEF header for a detailed destription of this // documentation in the CEF header for a detailed destription of this
// process. // process.
if (m_BrowserId == browser->GetIdentifier()) { if (browser_id_ == browser->GetIdentifier()) {
// Set a flag to indicate that the window close should be allowed. // 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 // 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); 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 // Free the browser pointer so that the browser can be destroyed
m_Browser = NULL; browser_ = NULL;
if (m_OSRHandler.get()) { if (osr_handler_.get()) {
m_OSRHandler->OnBeforeClose(browser); osr_handler_->OnBeforeClose(browser);
m_OSRHandler = NULL; osr_handler_ = NULL;
} }
} else if (browser->IsPopup()) { } else if (browser->IsPopup()) {
// Remove from the browser popup list. // Remove from the browser popup list.
BrowserList::iterator bit = m_PopupBrowsers.begin(); BrowserList::iterator bit = popup_browsers_.begin();
for (; bit != m_PopupBrowsers.end(); ++bit) { for (; bit != popup_browsers_.end(); ++bit) {
if ((*bit)->IsSame(browser)) { if ((*bit)->IsSame(browser)) {
m_PopupBrowsers.erase(bit); popup_browsers_.erase(bit);
break; break;
} }
} }
} }
if (--m_BrowserCount == 0) { if (--browser_count_ == 0) {
// All browser windows have closed. // All browser windows have closed.
// Remove and delete message router handlers. // Remove and delete message router handlers.
MessageHandlerSet::const_iterator it = message_handler_set_.begin(); MessageHandlerSet::const_iterator it = message_handler_set_.begin();
@ -558,15 +558,15 @@ void ClientHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
bool ClientHandler::GetRootScreenRect(CefRefPtr<CefBrowser> browser, bool ClientHandler::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) { CefRect& rect) {
if (!m_OSRHandler.get()) if (!osr_handler_.get())
return false; return false;
return m_OSRHandler->GetRootScreenRect(browser, rect); return osr_handler_->GetRootScreenRect(browser, rect);
} }
bool ClientHandler::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) { bool ClientHandler::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) {
if (!m_OSRHandler.get()) if (!osr_handler_.get())
return false; return false;
return m_OSRHandler->GetViewRect(browser, rect); return osr_handler_->GetViewRect(browser, rect);
} }
bool ClientHandler::GetScreenPoint(CefRefPtr<CefBrowser> browser, bool ClientHandler::GetScreenPoint(CefRefPtr<CefBrowser> browser,
@ -574,30 +574,30 @@ bool ClientHandler::GetScreenPoint(CefRefPtr<CefBrowser> browser,
int viewY, int viewY,
int& screenX, int& screenX,
int& screenY) { int& screenY) {
if (!m_OSRHandler.get()) if (!osr_handler_.get())
return false; 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, bool ClientHandler::GetScreenInfo(CefRefPtr<CefBrowser> browser,
CefScreenInfo& screen_info) { CefScreenInfo& screen_info) {
if (!m_OSRHandler.get()) if (!osr_handler_.get())
return false; return false;
return m_OSRHandler->GetScreenInfo(browser, screen_info); return osr_handler_->GetScreenInfo(browser, screen_info);
} }
void ClientHandler::OnPopupShow(CefRefPtr<CefBrowser> browser, void ClientHandler::OnPopupShow(CefRefPtr<CefBrowser> browser,
bool show) { bool show) {
if (!m_OSRHandler.get()) if (!osr_handler_.get())
return; return;
return m_OSRHandler->OnPopupShow(browser, show); return osr_handler_->OnPopupShow(browser, show);
} }
void ClientHandler::OnPopupSize(CefRefPtr<CefBrowser> browser, void ClientHandler::OnPopupSize(CefRefPtr<CefBrowser> browser,
const CefRect& rect) { const CefRect& rect) {
if (!m_OSRHandler.get()) if (!osr_handler_.get())
return; return;
return m_OSRHandler->OnPopupSize(browser, rect); return osr_handler_->OnPopupSize(browser, rect);
} }
void ClientHandler::OnPaint(CefRefPtr<CefBrowser> browser, void ClientHandler::OnPaint(CefRefPtr<CefBrowser> browser,
@ -606,53 +606,53 @@ void ClientHandler::OnPaint(CefRefPtr<CefBrowser> browser,
const void* buffer, const void* buffer,
int width, int width,
int height) { int height) {
if (!m_OSRHandler.get()) if (!osr_handler_.get())
return; 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, void ClientHandler::OnCursorChange(CefRefPtr<CefBrowser> browser,
CefCursorHandle cursor) { CefCursorHandle cursor) {
if (!m_OSRHandler.get()) if (!osr_handler_.get())
return; return;
m_OSRHandler->OnCursorChange(browser, cursor); osr_handler_->OnCursorChange(browser, cursor);
} }
bool ClientHandler::StartDragging(CefRefPtr<CefBrowser> browser, bool ClientHandler::StartDragging(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> drag_data, CefRefPtr<CefDragData> drag_data,
CefRenderHandler::DragOperationsMask allowed_ops, CefRenderHandler::DragOperationsMask allowed_ops,
int x, int y) { int x, int y) {
if (!m_OSRHandler.get()) if (!osr_handler_.get())
return false; 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, void ClientHandler::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
CefRenderHandler::DragOperation operation) { CefRenderHandler::DragOperation operation) {
if (!m_OSRHandler.get()) if (!osr_handler_.get())
return; 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); AutoLock lock_scope(this);
m_MainHwnd = hwnd; main_handle_ = handle;
} }
void ClientHandler::SetEditHwnd(ClientWindowHandle hwnd) { void ClientHandler::SetEditWindowHandle(ClientWindowHandle handle) {
AutoLock lock_scope(this); AutoLock lock_scope(this);
m_EditHwnd = hwnd; edit_handle_ = handle;
} }
void ClientHandler::SetButtonHwnds(ClientWindowHandle backHwnd, void ClientHandler::SetButtonWindowHandles(ClientWindowHandle backHandle,
ClientWindowHandle forwardHwnd, ClientWindowHandle forwardHandle,
ClientWindowHandle reloadHwnd, ClientWindowHandle reloadHandle,
ClientWindowHandle stopHwnd) { ClientWindowHandle stopHandle) {
AutoLock lock_scope(this); AutoLock lock_scope(this);
m_BackHwnd = backHwnd; back_handle_ = backHandle;
m_ForwardHwnd = forwardHwnd; forward_handle_ = forwardHandle;
m_ReloadHwnd = reloadHwnd; reload_handle_ = reloadHandle;
m_StopHwnd = stopHwnd; stop_handle_ = stopHandle;
} }
void ClientHandler::CloseAllBrowsers(bool force_close) { void ClientHandler::CloseAllBrowsers(bool force_close) {
@ -664,32 +664,32 @@ void ClientHandler::CloseAllBrowsers(bool force_close) {
return; return;
} }
if (!m_PopupBrowsers.empty()) { if (!popup_browsers_.empty()) {
// Request that any popup browsers close. // Request that any popup browsers close.
BrowserList::const_iterator it = m_PopupBrowsers.begin(); BrowserList::const_iterator it = popup_browsers_.begin();
for (; it != m_PopupBrowsers.end(); ++it) for (; it != popup_browsers_.end(); ++it)
(*it)->GetHost()->CloseBrowser(force_close); (*it)->GetHost()->CloseBrowser(force_close);
} }
if (m_Browser.get()) { if (browser_.get()) {
// Request that the main browser close. // Request that the main browser close.
m_Browser->GetHost()->CloseBrowser(force_close); browser_->GetHost()->CloseBrowser(force_close);
} }
} }
std::string ClientHandler::GetLogFile() { std::string ClientHandler::GetLogFile() {
AutoLock lock_scope(this); AutoLock lock_scope(this);
return m_LogFile; return log_file_;
} }
void ClientHandler::SetLastDownloadFile(const std::string& fileName) { void ClientHandler::SetLastDownloadFile(const std::string& fileName) {
AutoLock lock_scope(this); AutoLock lock_scope(this);
m_LastDownloadFile = fileName; last_download_file_ = fileName;
} }
std::string ClientHandler::GetLastDownloadFile() { std::string ClientHandler::GetLastDownloadFile() {
AutoLock lock_scope(this); AutoLock lock_scope(this);
return m_LastDownloadFile; return last_download_file_;
} }
void ClientHandler::ShowDevTools(CefRefPtr<CefBrowser> browser) { 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_->SetLastDownloadFile(tracing_file.ToString());
handler_->SendNotification(NOTIFY_DOWNLOAD_COMPLETE); 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); submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM3, "Radio Item 3", 0);
// Check the check item. // Check the check item.
if (m_TestMenuState.check_item) if (test_menu_state_.check_item)
submenu->SetChecked(CLIENT_ID_TESTMENU_CHECKITEM, true); submenu->SetChecked(CLIENT_ID_TESTMENU_CHECKITEM, true);
// Check the selected radio item. // Check the selected radio item.
submenu->SetChecked( 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) { bool ClientHandler::ExecuteTestMenu(int command_id) {
if (command_id == CLIENT_ID_TESTMENU_CHECKITEM) { if (command_id == CLIENT_ID_TESTMENU_CHECKITEM) {
// Toggle the check item. // Toggle the check item.
m_TestMenuState.check_item ^= 1; test_menu_state_.check_item ^= 1;
return true; return true;
} else if (command_id >= CLIENT_ID_TESTMENU_RADIOITEM1 && } else if (command_id >= CLIENT_ID_TESTMENU_RADIOITEM1 &&
command_id <= CLIENT_ID_TESTMENU_RADIOITEM3) { command_id <= CLIENT_ID_TESTMENU_RADIOITEM3) {
// Store the selected radio item. // 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; return true;
} }

View File

@ -244,20 +244,20 @@ class ClientHandler : public CefClient,
CefRenderHandler::DragOperation operation) CefRenderHandler::DragOperation operation)
OVERRIDE; OVERRIDE;
void SetMainHwnd(ClientWindowHandle hwnd); void SetMainWindowHandle(ClientWindowHandle handle);
ClientWindowHandle GetMainHwnd() { return m_MainHwnd; } ClientWindowHandle GetMainWindowHandle() { return main_handle_; }
void SetEditHwnd(ClientWindowHandle hwnd); void SetEditWindowHandle(ClientWindowHandle handle);
void SetOSRHandler(CefRefPtr<RenderHandler> handler) { void SetOSRHandler(CefRefPtr<RenderHandler> handler) {
m_OSRHandler = handler; osr_handler_ = handler;
} }
CefRefPtr<RenderHandler> GetOSRHandler() { return m_OSRHandler; } CefRefPtr<RenderHandler> GetOSRHandler() { return osr_handler_; }
void SetButtonHwnds(ClientWindowHandle backHwnd, void SetButtonWindowHandles(ClientWindowHandle backHandle,
ClientWindowHandle forwardHwnd, ClientWindowHandle forwardHandle,
ClientWindowHandle reloadHwnd, ClientWindowHandle reloadHandle,
ClientWindowHandle stopHwnd); ClientWindowHandle stopHandle);
CefRefPtr<CefBrowser> GetBrowser() { return m_Browser; } CefRefPtr<CefBrowser> GetBrowser() { return browser_; }
int GetBrowserId() { return m_BrowserId; } int GetBrowserId() { return browser_id_; }
// Request that all existing browser windows close. // Request that all existing browser windows close.
void CloseAllBrowsers(bool force_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 // Returns true if the main browser window is currently closing. Used in
// combination with DoClose() and the OS close notification to properly handle // combination with DoClose() and the OS close notification to properly handle
// 'onbeforeunload' JavaScript events during window close. // 'onbeforeunload' JavaScript events during window close.
bool IsClosing() { return m_bIsClosing; } bool IsClosing() { return is_closing_; }
std::string GetLogFile(); std::string GetLogFile();
@ -285,7 +285,7 @@ class ClientHandler : public CefClient,
void CloseDevTools(CefRefPtr<CefBrowser> browser); void CloseDevTools(CefRefPtr<CefBrowser> browser);
// Returns the startup URL. // Returns the startup URL.
std::string GetStartupURL() { return m_StartupURL; } std::string GetStartupURL() { return startup_url_; }
void BeginTracing(); void BeginTracing();
void EndTracing(); void EndTracing();
@ -307,53 +307,53 @@ class ClientHandler : public CefClient,
TestMenuState() : check_item(true), radio_item(0) {} TestMenuState() : check_item(true), radio_item(0) {}
bool check_item; bool check_item;
int radio_item; int radio_item;
} m_TestMenuState; } test_menu_state_;
// Returns the full download path for the specified file, or an empty path to // Returns the full download path for the specified file, or an empty path to
// use the default temp directory. // use the default temp directory.
std::string GetDownloadPath(const std::string& file_name); std::string GetDownloadPath(const std::string& file_name);
// The child browser window // The child browser window
CefRefPtr<CefBrowser> m_Browser; CefRefPtr<CefBrowser> browser_;
// List of any popup browser windows. Only accessed on the CEF UI thread. // List of any popup browser windows. Only accessed on the CEF UI thread.
typedef std::list<CefRefPtr<CefBrowser> > BrowserList; typedef std::list<CefRefPtr<CefBrowser> > BrowserList;
BrowserList m_PopupBrowsers; BrowserList popup_browsers_;
// The main frame window handle // The main frame window handle
ClientWindowHandle m_MainHwnd; ClientWindowHandle main_handle_;
// The child browser id // The child browser id
int m_BrowserId; int browser_id_;
// True if the main browser window is currently closing. // True if the main browser window is currently closing.
bool m_bIsClosing; bool is_closing_;
// The edit window handle // The edit window handle
ClientWindowHandle m_EditHwnd; ClientWindowHandle edit_handle_;
// The button window handles // The button window handles
ClientWindowHandle m_BackHwnd; ClientWindowHandle back_handle_;
ClientWindowHandle m_ForwardHwnd; ClientWindowHandle forward_handle_;
ClientWindowHandle m_StopHwnd; ClientWindowHandle stop_handle_;
ClientWindowHandle m_ReloadHwnd; ClientWindowHandle reload_handle_;
CefRefPtr<RenderHandler> m_OSRHandler; CefRefPtr<RenderHandler> osr_handler_;
// Support for logging. // Support for logging.
std::string m_LogFile; std::string log_file_;
// Support for downloading files. // Support for downloading files.
std::string m_LastDownloadFile; std::string last_download_file_;
// True if an editable field currently has focus. // True if an editable field currently has focus.
bool m_bFocusOnEditableField; bool focus_on_editable_field_;
// The startup URL. // The startup URL.
std::string m_StartupURL; std::string startup_url_;
// True if mouse cursor change is disabled. // 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 // Handles the browser side of query routing. The renderer side is handled
// in client_renderer.cpp. // in client_renderer.cpp.
@ -364,7 +364,7 @@ class ClientHandler : public CefClient,
// Number of currently existing browser windows. The application will exit // Number of currently existing browser windows. The application will exit
// when the number of windows reaches 0. // when the number of windows reaches 0.
static int m_BrowserCount; static int browser_count_;
#if defined(OS_LINUX) #if defined(OS_LINUX)
static void OnDialogResponse(GtkDialog *dialog, static void OnDialogResponse(GtkDialog *dialog,

View File

@ -156,8 +156,8 @@ bool ClientHandler::OnFileDialog(CefRefPtr<CefBrowser> browser,
} }
} }
GtkWidget* window = GtkWidget* window = gtk_widget_get_ancestor(
gtk_widget_get_ancestor(GTK_WIDGET(GetMainHwnd()), GTK_TYPE_WINDOW); GTK_WIDGET(GetMainWindowHandle()), GTK_TYPE_WINDOW);
GtkWidget* dialog = gtk_file_chooser_dialog_new( GtkWidget* dialog = gtk_file_chooser_dialog_new(
title_str.c_str(), title_str.c_str(),
GTK_WINDOW(window), GTK_WINDOW(window),
@ -218,10 +218,10 @@ void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
const CefString& url) { const CefString& url) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { if (browser_id_ == browser->GetIdentifier() && frame->IsMain()) {
// Set the edit window text // Set the edit window text
std::string urlStr(url); 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()) { if (!browser->IsPopup()) {
// Set the GTK parent window title. // 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_TYPE_WINDOW);
gtk_window_set_title(GTK_WINDOW(window), titleStr.c_str()); gtk_window_set_title(GTK_WINDOW(window), titleStr.c_str());
} else { } else {
@ -314,8 +314,8 @@ bool ClientHandler::OnJSDialog(CefRefPtr<CefBrowser> browser,
title += origin_url.ToString(); title += origin_url.ToString();
} }
GtkWidget* window = GtkWidget* window = gtk_widget_get_ancestor(
gtk_widget_get_ancestor(GTK_WIDGET(GetMainHwnd()), GTK_TYPE_WINDOW); GTK_WIDGET(GetMainWindowHandle()), GTK_TYPE_WINDOW);
gtk_dialog_ = gtk_message_dialog_new(GTK_WINDOW(window), gtk_dialog_ = gtk_message_dialog_new(GTK_WINDOW(window),
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,
gtk_message_type, gtk_message_type,
@ -401,21 +401,21 @@ void ClientHandler::SendNotification(NotificationType type) {
void ClientHandler::SetLoading(bool isLoading) { void ClientHandler::SetLoading(bool isLoading) {
if (isLoading) if (isLoading)
gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), true); gtk_widget_set_sensitive(GTK_WIDGET(stop_handle_), true);
else 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) { void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
if (canGoBack) if (canGoBack)
gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), true); gtk_widget_set_sensitive(GTK_WIDGET(back_handle_), true);
else else
gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), false); gtk_widget_set_sensitive(GTK_WIDGET(back_handle_), false);
if (canGoForward) if (canGoForward)
gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), true); gtk_widget_set_sensitive(GTK_WIDGET(forward_handle_), true);
else 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) { std::string ClientHandler::GetDownloadPath(const std::string& file_name) {

View File

@ -14,9 +14,9 @@ void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
const CefString& url) { const CefString& url) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { if (browser_id_ == browser->GetIdentifier() && frame->IsMain()) {
// Set the edit window text // Set the edit window text
NSTextField* textField = (NSTextField*)m_EditHwnd; NSTextField* textField = (NSTextField*)edit_handle_;
std::string urlStr(url); std::string urlStr(url);
NSString* str = [NSString stringWithUTF8String:urlStr.c_str()]; NSString* str = [NSString stringWithUTF8String:urlStr.c_str()];
[textField setStringValue:str]; [textField setStringValue:str];
@ -52,7 +52,7 @@ void ClientHandler::SendNotification(NotificationType type) {
if (sel == nil) if (sel == nil)
return; return;
NSWindow* window = [AppGetMainHwnd() window]; NSWindow* window = [AppGetMainWindowHandle() window];
NSObject* delegate = [window delegate]; NSObject* delegate = [window delegate];
[delegate performSelectorOnMainThread:sel withObject:nil waitUntilDone:NO]; [delegate performSelectorOnMainThread:sel withObject:nil waitUntilDone:NO];
} }

View File

@ -17,9 +17,9 @@ void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
const CefString& url) { const CefString& url) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { if (browser_id_ == browser->GetIdentifier() && frame->IsMain()) {
// Set the edit window text // 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 // Set the frame window title bar
CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle(); 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 // The frame window will be the parent of the browser window
hwnd = GetParent(hwnd); hwnd = GetParent(hwnd);
} }
@ -51,20 +51,21 @@ void ClientHandler::SendNotification(NotificationType type) {
default: default:
return; return;
} }
PostMessage(m_MainHwnd, WM_COMMAND, id, 0); PostMessage(main_handle_, WM_COMMAND, id, 0);
} }
void ClientHandler::SetLoading(bool isLoading) { void ClientHandler::SetLoading(bool isLoading) {
DCHECK(m_EditHwnd != NULL && m_ReloadHwnd != NULL && m_StopHwnd != NULL); DCHECK(edit_handle_ != NULL && reload_handle_ != NULL &&
EnableWindow(m_EditHwnd, TRUE); stop_handle_ != NULL);
EnableWindow(m_ReloadHwnd, !isLoading); EnableWindow(edit_handle_, TRUE);
EnableWindow(m_StopHwnd, isLoading); EnableWindow(reload_handle_, !isLoading);
EnableWindow(stop_handle_, isLoading);
} }
void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) { void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
DCHECK(m_BackHwnd != NULL && m_ForwardHwnd != NULL); DCHECK(back_handle_ != NULL && forward_handle_ != NULL);
EnableWindow(m_BackHwnd, canGoBack); EnableWindow(back_handle_, canGoBack);
EnableWindow(m_ForwardHwnd, canGoForward); EnableWindow(forward_handle_, canGoForward);
} }
std::string ClientHandler::GetDownloadPath(const std::string& file_name) { std::string ClientHandler::GetDownloadPath(const std::string& file_name) {

View File

@ -12,7 +12,7 @@
std::string AppGetWorkingDirectory() { std::string AppGetWorkingDirectory() {
return std::string(); return std::string();
} }
CefWindowHandle AppGetMainHwnd() { CefWindowHandle AppGetMainWindowHandle() {
return NULL; return NULL;
} }
void AppQuitMessageLoop() { void AppQuitMessageLoop() {