Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedding windowing #6016

Merged
merged 8 commits into from May 15, 2015

load passed url when creating cef_browser

  • Loading branch information
Mike Blumenkrantz
Mike Blumenkrantz committed May 12, 2015
commit 28968023ba08d50313cb243aff8d30d92832301f
@@ -11,12 +11,14 @@ use interfaces::{cef_request_context_t};
use servo::Browser;
use types::{cef_browser_settings_t, cef_string_t, cef_window_info_t};
use window;
use wrappers::CefWrap;

use compositing::windowing::{WindowNavigateMsg, WindowEvent};
use glutin_app;
use libc::c_int;
use std::borrow::ToOwned;
use std::cell::{Cell, RefCell, BorrowState};
use std::ptr;
use std::sync::atomic::{AtomicIsize, Ordering};

thread_local!(pub static ID_COUNTER: AtomicIsize = AtomicIsize::new(0));
@@ -211,13 +213,17 @@ pub fn browser_callback_after_created(browser: CefBrowser) {

fn browser_host_create(window_info: &cef_window_info_t,
client: CefClient,
url: *const cef_string_t,
callback_executed: bool)
-> CefBrowser {
let browser = ServoCefBrowser::new(window_info, client).as_cef_interface();
browser.init(window_info);
if callback_executed {
browser_callback_after_created(browser.clone());
}
if url != ptr::null() {
unsafe { browser.downcast().frame.load_url(CefWrap::to_rust(url)); }
}
BROWSERS.with(|browsers| {
browsers.borrow_mut().push(browser.clone());
});
@@ -227,27 +233,25 @@ fn browser_host_create(window_info: &cef_window_info_t,
cef_static_method_impls! {
fn cef_browser_host_create_browser(window_info: *const cef_window_info_t,
client: *mut cef_client_t,
_url: *const cef_string_t,
url: *const cef_string_t,
_browser_settings: *const cef_browser_settings_t,
_request_context: *mut cef_request_context_t)
-> c_int {{
let client: CefClient = client;
let _url: &[u16] = _url;
let _browser_settings: &cef_browser_settings_t = _browser_settings;
let _request_context: CefRequestContext = _request_context;
browser_host_create(window_info, client, false);
browser_host_create(window_info, client, url, false);
1i32
}}
fn cef_browser_host_create_browser_sync(window_info: *const cef_window_info_t,
client: *mut cef_client_t,
_url: *const cef_string_t,
url: *const cef_string_t,
_browser_settings: *const cef_browser_settings_t,
_request_context: *mut cef_request_context_t)
-> *mut cef_browser_t {{
let client: CefClient = client;
let _url: &[u16] = _url;
let _browser_settings: &cef_browser_settings_t = _browser_settings;
let _request_context: CefRequestContext = _request_context;
browser_host_create(window_info, client, true)
browser_host_create(window_info, client, url, true)
}}
}
@@ -16,8 +16,7 @@ use std_url::Url;

const MAX_RENDERING_THREADS: usize = 128;

// TODO(pcwalton): Get the home page via the CEF API.
static HOME_URL: &'static str = "http://s27.postimg.org/vqbtrolyr/servo.jpg";
//static HOME_URL: &'static str = "http://s27.postimg.org/vqbtrolyr/servo.jpg";

static CEF_API_HASH_UNIVERSAL: &'static [u8] = b"8efd129f4afc344bd04b2feb7f73a149b6c4e27f\0";
#[cfg(target_os="windows")]
@@ -71,7 +70,6 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
};

let mut temp_opts = opts::default_opts();
temp_opts.url = Url::parse(HOME_URL).unwrap();
temp_opts.paint_threads = rendering_threads;
temp_opts.layout_threads = rendering_threads;
temp_opts.headless = false;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.