bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) {
  CEF_REQUIRE_UI_THREAD();

  // Closing the main window requires special handling. See the DoClose()
  // documentation in the CEF header for a detailed destription of this
  // process.
  if (GetBrowserId() == browser->GetIdentifier()) {
      
      if (!popup_browsers_.empty()) {
        // Request that any popup browsers close.
        BrowserList::const_iterator it = popup_browsers_.begin();
        for (; it != popup_browsers_.end(); ++it)
          (*it)->GetHost()->CloseBrowser(true);
      }
      
    base::AutoLock lock_scope(lock_);
    // Set a flag to indicate that the window close should be allowed.
    is_closing_ = true;

    developerStudioProcess->StopProcess(); 

  }

  // Allow the close. For windowed browsers this will result in the OS close
  // event being sent.
  return false;
}
Example #2
0
void CefClientImpl::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
	CEF_REQUIRE_UI_THREAD();

	if (GetBrowserId() == browser->GetIdentifier())
	{
		base::AutoLock lock_scope(lock_);
			// Free the browser pointer so that the browser can be destroyed
		browser_child = NULL;
	}
	else if(browser->IsPopup())
	{
		// Remove from the browser popup list.
		BrowserList::iterator bit = popup_browsers_.begin();
		for (; bit != popup_browsers_.end(); ++bit) {
			if ((*bit)->IsSame(browser)) {
				popup_browsers_.erase(bit);
				break;
			}
		}
	}

	if (--browser_count_ == 0) {
		// All browser windows have closed.
		// Remove and delete message router handlers.
		message_router_ = NULL;
		// Quit the application message loop.
		PostMessage(hMessageWnd,WM_COMMAND,ID_QUIT,0);
	}
}
Example #3
0
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
                                    CefRefPtr<CefFrame> frame,
                                    const CefString& url) {
  CEF_REQUIRE_UI_THREAD();

  if (GetBrowserId() == browser->GetIdentifier() && frame->IsMain()) {
    // Set the edit window text
    SetWindowText(edit_handle_, std::wstring(url).c_str());
  }
}
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
                                    CefRefPtr<CefFrame> frame,
                                    const CefString& url) {
  CEF_REQUIRE_UI_THREAD();

  if (GetBrowserId() == browser->GetIdentifier() && frame->IsMain()) {
      // Set the edit window text
    std::string urlStr(url);
    gtk_entry_set_text(GTK_ENTRY(edit_handle_), urlStr.c_str());
  }
}
Example #5
0
bool CefClientImpl::DoClose(CefRefPtr<CefBrowser> browser) {
	CEF_REQUIRE_UI_THREAD();

	if (GetBrowserId() == browser->GetIdentifier()) {
		base::AutoLock lock_scope(lock_);
		// Set a flag to indicate that the window close should be allowed.
		is_closing_ = true;
	}

	return false;
}
Example #6
0
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
                                  const CefString& title) {
  CEF_REQUIRE_UI_THREAD();

  // Set the frame window title bar
  CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();
  if (GetBrowserId() == browser->GetIdentifier()) {
    // The frame window will be the parent of the browser window
    hwnd = GetParent(hwnd);
  }
  SetWindowText(hwnd, std::wstring(title).c_str());
}
bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) {
  CEF_REQUIRE_UI_THREAD();

  // Closing the main window requires special handling. See the DoClose()
  // documentation in the CEF header for a detailed destription of this
  // process.
  if (GetBrowserId() == browser->GetIdentifier()) {
    base::AutoLock lock_scope(lock_);
    // Set a flag to indicate that the window close should be allowed.
    is_closing_ = true;
  }

  // Allow the close. For windowed browsers this will result in the OS close
  // event being sent.
  return false;
}
void ClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
  CEF_REQUIRE_UI_THREAD();

  message_router_->OnBeforeClose(browser);

  if (GetBrowserId() == browser->GetIdentifier()) {
    {
      base::AutoLock lock_scope(lock_);
      // Free the browser pointer so that the browser can be destroyed
      browser_ = 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 = popup_browsers_.begin();
    for (; bit != popup_browsers_.end(); ++bit) {
      if ((*bit)->IsSame(browser)) {
        popup_browsers_.erase(bit);
        break;
      }
    }
  }

  if (--browser_count_ == 0) {
    // All browser windows have closed.
    // Remove and delete message router handlers.
    MessageHandlerSet::const_iterator it = message_handler_set_.begin();
    for (; it != message_handler_set_.end(); ++it) {
      message_router_->RemoveHandler(*(it));
      delete *(it);
    }
    message_handler_set_.clear();
    message_router_ = NULL;

    // Quit the application message loop.
    AppQuitMessageLoop();
  }
}