mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-16 20:20:51 +01:00
Update to Chromium revision 149431.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@730 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
c91f8132d5
commit
b39ca211ae
@ -17,5 +17,5 @@
|
||||
|
||||
{
|
||||
'chromium_url': 'http://src.chromium.org/svn/trunk/src',
|
||||
'chromium_revision': '142910',
|
||||
'chromium_revision': '149431',
|
||||
}
|
||||
|
6
cef.gyp
6
cef.gyp
@ -619,7 +619,6 @@
|
||||
'<(DEPTH)/content/content_resources.gyp:content_resources',
|
||||
'<(DEPTH)/net/net.gyp:net_resources',
|
||||
'<(DEPTH)/ui/ui.gyp:ui_resources',
|
||||
'<(DEPTH)/ui/ui.gyp:ui_resources_standard',
|
||||
'<(DEPTH)/webkit/support/webkit_support.gyp:webkit_resources',
|
||||
'cef_locales',
|
||||
'cef_resources',
|
||||
@ -635,8 +634,7 @@
|
||||
'pak_inputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources_100_percent.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak',
|
||||
@ -660,7 +658,6 @@
|
||||
'<(SHARED_INTERMEDIATE_DIR)/content/grit/content_resources.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/net/grit/net_resources.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/grit/ui_resources.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/grit/ui_resources_standard.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/webkit/grit/devtools_resources.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/webkit/grit/webkit_chromium_resources.h',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/webkit/grit/webkit_resources.h',
|
||||
@ -936,6 +933,7 @@
|
||||
'libcef/browser/browser_host_impl_gtk.cc',
|
||||
'libcef/browser/browser_main_gtk.cc',
|
||||
'libcef/browser/gtk_util_stub.cc',
|
||||
'libcef/browser/javascript_dialog_gtk.cc',
|
||||
'libcef/browser/menu_creator_runner_gtk.cc',
|
||||
'libcef/browser/menu_creator_runner_gtk.h',
|
||||
# Include sources for context menu implementation.
|
||||
|
@ -166,6 +166,7 @@
|
||||
],
|
||||
'cefclient_bundle_resources_linux': [
|
||||
'tests/cefclient/res/binding.html',
|
||||
'tests/cefclient/res/dialogs.html',
|
||||
'tests/cefclient/res/domaccess.html',
|
||||
'tests/cefclient/res/localstorage.html',
|
||||
'tests/cefclient/res/logo.png',
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "content/public/browser/notification_types.h"
|
||||
#include "content/public/browser/resource_request_info.h"
|
||||
#include "content/public/common/file_chooser_params.h"
|
||||
#include "content/public/common/selected_file_info.h"
|
||||
#include "ui/base/dialogs/selected_file_info.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -1092,11 +1092,9 @@ void CefBrowserHostImpl::RunFileChooser(
|
||||
base::PLATFORM_FILE_ASYNC;
|
||||
|
||||
// Convert FilePath list to SelectedFileInfo list.
|
||||
std::vector<content::SelectedFileInfo> selected_files;
|
||||
for (size_t i = 0; i < fileList.size(); ++i) {
|
||||
selected_files.push_back(
|
||||
content::SelectedFileInfo(fileList[i], FilePath::StringType()));
|
||||
}
|
||||
std::vector<ui::SelectedFileInfo> selected_files;
|
||||
for (size_t i = 0; i < fileList.size(); ++i)
|
||||
selected_files.push_back(ui::SelectedFileInfo(fileList[i], FilePath()));
|
||||
|
||||
// Notify our RenderViewHost in all cases.
|
||||
render_view_host->FilesSelectedInChooser(selected_files,
|
||||
@ -1198,20 +1196,24 @@ void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
||||
has_document_ = true;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidFinishLoad(int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame) {
|
||||
void CefBrowserHostImpl::DidFinishLoad(
|
||||
int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
content::RenderViewHost* render_view_host) {
|
||||
CefRefPtr<CefFrame> frame = GetOrCreateFrame(frame_id,
|
||||
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(),
|
||||
validated_url);
|
||||
OnLoadEnd(frame, validated_url);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidFailLoad(int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
int error_code,
|
||||
const string16& error_description) {
|
||||
void CefBrowserHostImpl::DidFailLoad(
|
||||
int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
int error_code,
|
||||
const string16& error_description,
|
||||
content::RenderViewHost* render_view_host) {
|
||||
CefRefPtr<CefFrame> frame = GetOrCreateFrame(frame_id,
|
||||
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(),
|
||||
validated_url);
|
||||
@ -1384,7 +1386,7 @@ CefBrowserHostImpl::CefBrowserHostImpl(const CefWindowInfo& window_info,
|
||||
registrar_.reset(new content::NotificationRegistrar);
|
||||
registrar_->Add(this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
|
||||
content::Source<content::WebContents>(web_contents));
|
||||
|
||||
|
||||
response_manager_.reset(new CefResponseManager);
|
||||
|
||||
placeholder_frame_ =
|
||||
|
@ -261,12 +261,15 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
virtual void DocumentAvailableInMainFrame() OVERRIDE;
|
||||
virtual void DidFinishLoad(int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame) OVERRIDE;
|
||||
bool is_main_frame,
|
||||
content::RenderViewHost* render_view_host)
|
||||
OVERRIDE;
|
||||
virtual void DidFailLoad(int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
int error_code,
|
||||
const string16& error_description) OVERRIDE;
|
||||
const string16& error_description,
|
||||
content::RenderViewHost* render_view_host) OVERRIDE;
|
||||
virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE;
|
||||
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
||||
// Override to provide a thread safe implementation.
|
||||
|
@ -11,8 +11,8 @@ CefBrowserMessageLoop::CefBrowserMessageLoop()
|
||||
CefBrowserMessageLoop::~CefBrowserMessageLoop() {
|
||||
#if defined(OS_MACOSX)
|
||||
// On Mac the MessageLoop::AutoRunState scope in Run() never exits so clear
|
||||
// the state_ variable to avoid an assertion in the MessageLoop destructor.
|
||||
state_ = NULL;
|
||||
// the run_loop_ variable to avoid an assertion in the MessageLoop destructor.
|
||||
run_loop_ = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -32,11 +32,7 @@ bool CefBrowserMessageLoop::DoIdleWork() {
|
||||
|
||||
// Do a single interation of the UI message loop.
|
||||
void CefBrowserMessageLoop::DoMessageLoopIteration() {
|
||||
#if defined(OS_MACOSX)
|
||||
Run();
|
||||
#else
|
||||
RunWithDispatcher(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Run the UI message loop.
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "content/public/common/url_fetcher.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/url_request/url_fetcher.h"
|
||||
#include "net/url_request/url_fetcher_delegate.h"
|
||||
#include "net/url_request/url_request_status.h"
|
||||
|
||||
@ -109,8 +110,8 @@ class CefBrowserURLRequest::Context
|
||||
fetcher_delegate_.reset(
|
||||
new CefURLFetcherDelegate(this, request_->GetFlags()));
|
||||
|
||||
fetcher_.reset(content::URLFetcher::Create(url, request_type,
|
||||
fetcher_delegate_.get()));
|
||||
fetcher_.reset(net::URLFetcher::Create(url, request_type,
|
||||
fetcher_delegate_.get()));
|
||||
fetcher_->SetRequestContext(
|
||||
_Context->browser_context()->GetRequestContext());
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "content/public/app/content_main.h"
|
||||
#include "content/public/app/content_main_runner.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "sandbox/src/sandbox_types.h"
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
@ -28,6 +27,7 @@
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "content/public/app/startup_helper_win.h"
|
||||
#include "sandbox/win/src/sandbox_types.h"
|
||||
#endif
|
||||
|
||||
// Both the CefContext constuctor and the CefContext::RemoveBrowser method need
|
||||
|
@ -4,7 +4,9 @@
|
||||
|
||||
#include "libcef/browser/cookie_manager_impl.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/context.h"
|
||||
@ -20,6 +22,7 @@
|
||||
#include "chrome/browser/net/sqlite_persistent_cookie_store.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "net/cookies/cookie_util.h"
|
||||
#include "net/cookies/parsed_cookie.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
|
||||
namespace {
|
||||
@ -41,7 +44,7 @@ class VisitCookiesCallback : public base::RefCounted<VisitCookiesCallback> {
|
||||
net::CookieList::const_iterator it = list.begin();
|
||||
for (; it != list.end(); ++it, ++count) {
|
||||
CefCookie cookie;
|
||||
const net::CookieMonster::CanonicalCookie& cc = *(it);
|
||||
const net::CanonicalCookie& cc = *(it);
|
||||
CefCookieManagerImpl::GetCefCookie(cc, cookie);
|
||||
|
||||
bool deleteCookie = false;
|
||||
@ -65,7 +68,7 @@ class VisitCookiesCallback : public base::RefCounted<VisitCookiesCallback> {
|
||||
|
||||
// Determine the cookie domain to use for setting the specified cookie.
|
||||
bool GetCookieDomain(const GURL& url,
|
||||
const net::CookieMonster::ParsedCookie& pc,
|
||||
const net::ParsedCookie& pc,
|
||||
std::string* result) {
|
||||
std::string domain_string;
|
||||
if (pc.HasDomain())
|
||||
@ -74,66 +77,6 @@ bool GetCookieDomain(const GURL& url,
|
||||
result);
|
||||
}
|
||||
|
||||
std::string CanonPathWithString(const GURL& url,
|
||||
const std::string& path_string) {
|
||||
// The RFC says the path should be a prefix of the current URL path.
|
||||
// However, Mozilla allows you to set any path for compatibility with
|
||||
// broken websites. We unfortunately will mimic this behavior. We try
|
||||
// to be generous and accept cookies with an invalid path attribute, and
|
||||
// default the path to something reasonable.
|
||||
|
||||
// The path was supplied in the cookie, we'll take it.
|
||||
if (!path_string.empty() && path_string[0] == '/')
|
||||
return path_string;
|
||||
|
||||
// The path was not supplied in the cookie or invalid, we will default
|
||||
// to the current URL path.
|
||||
// """Defaults to the path of the request URL that generated the
|
||||
// Set-Cookie response, up to, but not including, the
|
||||
// right-most /."""
|
||||
// How would this work for a cookie on /? We will include it then.
|
||||
const std::string& url_path = url.path();
|
||||
|
||||
size_t idx = url_path.find_last_of('/');
|
||||
|
||||
// The cookie path was invalid or a single '/'.
|
||||
if (idx == 0 || idx == std::string::npos)
|
||||
return std::string("/");
|
||||
|
||||
// Return up to the rightmost '/'.
|
||||
return url_path.substr(0, idx);
|
||||
}
|
||||
|
||||
std::string CanonPath(const GURL& url,
|
||||
const net::CookieMonster::ParsedCookie& pc) {
|
||||
std::string path_string;
|
||||
if (pc.HasPath())
|
||||
path_string = pc.Path();
|
||||
return CanonPathWithString(url, path_string);
|
||||
}
|
||||
|
||||
base::Time CanonExpiration(const net::CookieMonster::ParsedCookie& pc,
|
||||
const base::Time& current) {
|
||||
// First, try the Max-Age attribute.
|
||||
uint64 max_age = 0;
|
||||
if (pc.HasMaxAge() &&
|
||||
#ifdef COMPILER_MSVC
|
||||
sscanf_s(
|
||||
#else
|
||||
sscanf(
|
||||
#endif
|
||||
pc.MaxAge().c_str(), " %" PRIu64, &max_age) == 1) {
|
||||
return current + base::TimeDelta::FromSeconds(max_age);
|
||||
}
|
||||
|
||||
// Try the Expires attribute.
|
||||
if (pc.HasExpires())
|
||||
return net::CookieMonster::ParseCookieTime(pc.Expires());
|
||||
|
||||
// Invalid or no expiration, persistent cookie.
|
||||
return base::Time();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -318,7 +261,7 @@ bool CefCookieManagerImpl::SetStoragePath(const CefString& path) {
|
||||
GetCookieMonster();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (cookie_monster_ && ((storage_path_.empty() && path.empty()) ||
|
||||
storage_path_ == new_path)) {
|
||||
// The path has not changed so don't do anything.
|
||||
@ -373,9 +316,8 @@ void CefCookieManagerImpl::SetGlobal() {
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefCookieManagerImpl::GetCefCookie(
|
||||
const net::CookieMonster::CanonicalCookie& cc,
|
||||
CefCookie& cookie) {
|
||||
bool CefCookieManagerImpl::GetCefCookie(const net::CanonicalCookie& cc,
|
||||
CefCookie& cookie) {
|
||||
CefString(&cookie.name).FromString(cc.Name());
|
||||
CefString(&cookie.value).FromString(cc.Value());
|
||||
CefString(&cookie.domain).FromString(cc.Domain());
|
||||
@ -384,7 +326,7 @@ bool CefCookieManagerImpl::GetCefCookie(
|
||||
cookie.httponly = cc.IsHttpOnly();
|
||||
cef_time_from_basetime(cc.CreationDate(), cookie.creation);
|
||||
cef_time_from_basetime(cc.LastAccessDate(), cookie.last_access);
|
||||
cookie.has_expires = cc.DoesExpire();
|
||||
cookie.has_expires = cc.IsPersistent();
|
||||
if (cookie.has_expires)
|
||||
cef_time_from_basetime(cc.ExpiryDate(), cookie.expires);
|
||||
|
||||
@ -396,7 +338,7 @@ bool CefCookieManagerImpl::GetCefCookie(const GURL& url,
|
||||
const std::string& cookie_line,
|
||||
CefCookie& cookie) {
|
||||
// Parse the cookie.
|
||||
net::CookieMonster::ParsedCookie pc(cookie_line);
|
||||
net::ParsedCookie pc(cookie_line);
|
||||
if (!pc.IsValid())
|
||||
return false;
|
||||
|
||||
@ -404,9 +346,10 @@ bool CefCookieManagerImpl::GetCefCookie(const GURL& url,
|
||||
if (!GetCookieDomain(url, pc, &cookie_domain))
|
||||
return false;
|
||||
|
||||
std::string cookie_path = CanonPath(url, pc);
|
||||
std::string cookie_path = net::CanonicalCookie::CanonPath(url, pc);
|
||||
base::Time creation_time = base::Time::Now();
|
||||
base::Time cookie_expires = CanonExpiration(pc, creation_time);
|
||||
base::Time cookie_expires =
|
||||
net::CanonicalCookie::CanonExpiration(pc, creation_time, creation_time);
|
||||
|
||||
CefString(&cookie.name).FromString(pc.Name());
|
||||
CefString(&cookie.value).FromString(pc.Value());
|
||||
|
@ -32,8 +32,7 @@ class CefCookieManagerImpl : public CefCookieManager {
|
||||
|
||||
net::CookieMonster* cookie_monster() { return cookie_monster_; }
|
||||
|
||||
static bool GetCefCookie(const net::CookieMonster::CanonicalCookie& cc,
|
||||
CefCookie& cookie);
|
||||
static bool GetCefCookie(const net::CanonicalCookie& cc, CefCookie& cookie);
|
||||
static bool GetCefCookie(const GURL& url, const std::string& cookie_line,
|
||||
CefCookie& cookie);
|
||||
|
||||
|
@ -58,9 +58,11 @@ scoped_refptr<content::DownloadManager> GetDownloadManager() {
|
||||
class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
public:
|
||||
CefBeforeDownloadCallbackImpl(int32 download_id,
|
||||
const FilePath& suggested_name)
|
||||
const FilePath& suggested_name,
|
||||
const content::DownloadTargetCallback& callback)
|
||||
: download_id_(download_id),
|
||||
suggested_name_(suggested_name) {
|
||||
suggested_name_(suggested_name),
|
||||
callback_(callback) {
|
||||
}
|
||||
|
||||
virtual void Continue(const CefString& download_path,
|
||||
@ -74,10 +76,12 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
FilePath path = FilePath(download_path);
|
||||
CEF_POST_TASK(CEF_FILET,
|
||||
base::Bind(&CefBeforeDownloadCallbackImpl::GenerateFilename,
|
||||
download_id_, suggested_name_, path, show_dialog));
|
||||
download_id_, suggested_name_, path, show_dialog,
|
||||
callback_));
|
||||
}
|
||||
|
||||
download_id_ = 0;
|
||||
callback_.Reset();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBeforeDownloadCallbackImpl::Continue, this,
|
||||
@ -86,10 +90,12 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
}
|
||||
|
||||
private:
|
||||
static void GenerateFilename(int32 download_id,
|
||||
const FilePath& suggested_name,
|
||||
const FilePath& download_path,
|
||||
bool show_dialog) {
|
||||
static void GenerateFilename(
|
||||
int32 download_id,
|
||||
const FilePath& suggested_name,
|
||||
const FilePath& download_path,
|
||||
bool show_dialog,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
FilePath suggested_path = download_path;
|
||||
if (!suggested_path.empty()) {
|
||||
// Create the directory if necessary.
|
||||
@ -111,18 +117,16 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
}
|
||||
}
|
||||
|
||||
content::DownloadItem::TargetDisposition disposition = show_dialog ?
|
||||
DownloadItem::TARGET_DISPOSITION_PROMPT :
|
||||
DownloadItem::TARGET_DISPOSITION_OVERWRITE;
|
||||
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBeforeDownloadCallbackImpl::RestartDownload,
|
||||
download_id, suggested_path, disposition));
|
||||
base::Bind(&CefBeforeDownloadCallbackImpl::ChooseDownloadPath,
|
||||
download_id, suggested_path, show_dialog, callback));
|
||||
}
|
||||
|
||||
static void RestartDownload(int32 download_id,
|
||||
const FilePath& suggested_path,
|
||||
DownloadItem::TargetDisposition disposition) {
|
||||
static void ChooseDownloadPath(
|
||||
int32 download_id,
|
||||
const FilePath& suggested_path,
|
||||
bool show_dialog,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
scoped_refptr<content::DownloadManager> manager = GetDownloadManager();
|
||||
if (!manager)
|
||||
return;
|
||||
@ -131,14 +135,28 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
item->OnTargetPathDetermined(suggested_path,
|
||||
disposition,
|
||||
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
|
||||
manager->RestartDownload(download_id);
|
||||
FilePath result;
|
||||
if (show_dialog) {
|
||||
#if defined(OS_WIN) || defined(OS_MACOSX)
|
||||
WebContents* web_contents = item->GetWebContents();
|
||||
result = CefDownloadManagerDelegate::PlatformChooseDownloadPath(
|
||||
web_contents, suggested_path);
|
||||
#else
|
||||
NOTIMPLEMENTED();
|
||||
#endif
|
||||
} else {
|
||||
result = suggested_path;
|
||||
}
|
||||
|
||||
callback.Run(result,
|
||||
DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
result);
|
||||
}
|
||||
|
||||
int32 download_id_;
|
||||
FilePath suggested_name_;
|
||||
content::DownloadTargetCallback callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefBeforeDownloadCallbackImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBeforeDownloadCallbackImpl);
|
||||
@ -183,20 +201,25 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
|
||||
|
||||
|
||||
CefDownloadManagerDelegate::CefDownloadManagerDelegate() {
|
||||
// Balanced in Shutdown();
|
||||
AddRef();
|
||||
}
|
||||
|
||||
CefDownloadManagerDelegate::~CefDownloadManagerDelegate() {
|
||||
}
|
||||
|
||||
bool CefDownloadManagerDelegate::ShouldStartDownload(int32 download_id) {
|
||||
scoped_refptr<content::DownloadManager> manager = GetDownloadManager();
|
||||
DownloadItem* item = manager->GetActiveDownloadItem(download_id);
|
||||
void CefDownloadManagerDelegate::Shutdown() {
|
||||
Release();
|
||||
}
|
||||
|
||||
bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
content::DownloadItem* item,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
if (!item->GetForcedFilePath().empty()) {
|
||||
item->OnTargetPathDetermined(
|
||||
item->GetForcedFilePath(),
|
||||
DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
|
||||
callback.Run(item->GetForcedFilePath(),
|
||||
DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
item->GetForcedFilePath());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -215,35 +238,17 @@ bool CefDownloadManagerDelegate::ShouldStartDownload(int32 download_id) {
|
||||
"download");
|
||||
|
||||
CefRefPtr<CefDownloadItemImpl> download_item(new CefDownloadItemImpl(item));
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback(
|
||||
new CefBeforeDownloadCallbackImpl(download_id, suggested_name));
|
||||
CefRefPtr<CefBeforeDownloadCallback> callbackObj(
|
||||
new CefBeforeDownloadCallbackImpl(item->GetId(), suggested_name,
|
||||
callback));
|
||||
|
||||
handler->OnBeforeDownload(browser.get(), download_item.get(),
|
||||
suggested_name.value(), callback);
|
||||
suggested_name.value(), callbackObj);
|
||||
|
||||
download_item->Detach(NULL);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::ChooseDownloadPath(
|
||||
content::DownloadItem* item) {
|
||||
FilePath result;
|
||||
#if defined(OS_WIN) || defined(OS_MACOSX)
|
||||
WebContents* web_contents = item->GetWebContents();
|
||||
const FilePath suggested_path(item->GetTargetFilePath());
|
||||
result = PlatformChooseDownloadPath(web_contents, suggested_path);
|
||||
#else
|
||||
NOTIMPLEMENTED();
|
||||
#endif
|
||||
|
||||
scoped_refptr<content::DownloadManager> manager = GetDownloadManager();
|
||||
if (result.empty()) {
|
||||
manager->FileSelectionCanceled(item->GetId());
|
||||
} else {
|
||||
manager->FileSelected(result, item->GetId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::AddItemToPersistentStore(
|
||||
|
@ -23,20 +23,22 @@ class CefDownloadManagerDelegate
|
||||
CefDownloadManagerDelegate();
|
||||
|
||||
// DownloadManagerDelegate methods.
|
||||
virtual bool ShouldStartDownload(int32 download_id) OVERRIDE;
|
||||
virtual void ChooseDownloadPath(content::DownloadItem* item) OVERRIDE;
|
||||
virtual void Shutdown() OVERRIDE;
|
||||
virtual bool DetermineDownloadTarget(
|
||||
content::DownloadItem* item,
|
||||
const content::DownloadTargetCallback& callback) OVERRIDE;
|
||||
virtual void AddItemToPersistentStore(content::DownloadItem* item) OVERRIDE;
|
||||
virtual void UpdateItemInPersistentStore(
|
||||
content::DownloadItem* item) OVERRIDE;
|
||||
|
||||
static FilePath PlatformChooseDownloadPath(content::WebContents* web_contents,
|
||||
const FilePath& suggested_path);
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<CefDownloadManagerDelegate>;
|
||||
|
||||
virtual ~CefDownloadManagerDelegate();
|
||||
|
||||
FilePath PlatformChooseDownloadPath(content::WebContents* web_contents,
|
||||
const FilePath& suggested_path);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate);
|
||||
};
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "base/sys_string_conversions.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
||||
// static
|
||||
FilePath CefDownloadManagerDelegate::PlatformChooseDownloadPath(
|
||||
content::WebContents* web_contents,
|
||||
const FilePath& suggested_path) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "base/string_util.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
||||
|
||||
// static
|
||||
FilePath CefDownloadManagerDelegate::PlatformChooseDownloadPath(
|
||||
content::WebContents* web_contents,
|
||||
const FilePath& suggested_path) {
|
||||
|
@ -9,6 +9,10 @@
|
||||
|
||||
#include "content/public/browser/javascript_dialogs.h"
|
||||
|
||||
#if defined(TOOLKIT_GTK)
|
||||
#include "ui/base/gtk/gtk_signal.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if __OBJC__
|
||||
@class CefJavaScriptDialogHelper;
|
||||
@ -59,6 +63,9 @@ class CefJavaScriptDialog {
|
||||
static LRESULT CALLBACK GetMsgProc(int code, WPARAM wparam, LPARAM lparam);
|
||||
static HHOOK msg_hook_;
|
||||
static int msg_hook_user_count_;
|
||||
#elif defined(TOOLKIT_GTK)
|
||||
GtkWidget* gtk_dialog_;
|
||||
CHROMEGTK_CALLBACK_1(CefJavaScriptDialog, void, OnResponse, int);
|
||||
#endif
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefJavaScriptDialog);
|
||||
|
@ -107,7 +107,7 @@ void CefJavaScriptDialogCreator::RunJavaScriptDialog(
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
|
||||
*did_suppress_message = false;
|
||||
|
||||
if (dialog_.get()) {
|
||||
@ -153,7 +153,7 @@ void CefJavaScriptDialogCreator::RunBeforeUnloadDialog(
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
|
||||
if (dialog_.get()) {
|
||||
// Seriously!?
|
||||
callback.Run(true, string16());
|
||||
@ -164,12 +164,13 @@ void CefJavaScriptDialogCreator::RunBeforeUnloadDialog(
|
||||
message_text +
|
||||
ASCIIToUTF16("\n\nIs it OK to leave/reload this page?");
|
||||
|
||||
dialog_.reset(new CefJavaScriptDialog(this,
|
||||
content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM,
|
||||
string16(), // display_url
|
||||
new_message_text,
|
||||
string16(), // default_prompt_text
|
||||
callback));
|
||||
dialog_.reset(
|
||||
new CefJavaScriptDialog(this,
|
||||
content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM,
|
||||
string16(), // display_url
|
||||
new_message_text,
|
||||
string16(), // default_prompt_text
|
||||
callback));
|
||||
#else
|
||||
// TODO(port): implement CefJavaScriptDialog for other platforms.
|
||||
callback.Run(true, string16());
|
||||
@ -188,7 +189,7 @@ void CefJavaScriptDialogCreator::ResetJavaScriptState(
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
|
||||
if (dialog_.get()) {
|
||||
dialog_->Cancel();
|
||||
dialog_.reset();
|
||||
@ -197,7 +198,7 @@ void CefJavaScriptDialogCreator::ResetJavaScriptState(
|
||||
}
|
||||
|
||||
void CefJavaScriptDialogCreator::DialogClosed(CefJavaScriptDialog* dialog) {
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
|
||||
DCHECK_EQ(dialog, dialog_.get());
|
||||
dialog_.reset();
|
||||
#endif
|
||||
|
@ -50,7 +50,7 @@ class CefJavaScriptDialogCreator : public content::JavaScriptDialogCreator {
|
||||
// This pointer is guaranteed to outlive the CefJavaScriptDialogCreator.
|
||||
CefBrowserHostImpl* browser_;
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
|
||||
// The dialog being shown. No queueing.
|
||||
scoped_ptr<CefJavaScriptDialog> dialog_;
|
||||
#endif
|
||||
|
135
libcef/browser/javascript_dialog_gtk.cc
Normal file
135
libcef/browser/javascript_dialog_gtk.cc
Normal file
@ -0,0 +1,135 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/javascript_dialog.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/javascript_dialog_creator.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/string_util.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const char kPromptTextId[] = "cef_prompt_text";
|
||||
|
||||
// If there's a text entry in the dialog, get the text from the first one and
|
||||
// return it.
|
||||
string16 GetPromptText(GtkDialog* dialog) {
|
||||
GtkWidget* widget = static_cast<GtkWidget*>(
|
||||
g_object_get_data(G_OBJECT(dialog), kPromptTextId));
|
||||
if (widget)
|
||||
return UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(widget)));
|
||||
return string16();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefJavaScriptDialog::CefJavaScriptDialog(
|
||||
CefJavaScriptDialogCreator* creator,
|
||||
content::JavaScriptMessageType message_type,
|
||||
const string16& display_url,
|
||||
const string16& message_text,
|
||||
const string16& default_prompt_text,
|
||||
const content::JavaScriptDialogCreator::DialogClosedCallback& callback)
|
||||
: creator_(creator),
|
||||
callback_(callback) {
|
||||
GtkButtonsType buttons = GTK_BUTTONS_NONE;
|
||||
GtkMessageType gtk_message_type = GTK_MESSAGE_OTHER;
|
||||
std::string title;
|
||||
|
||||
switch (message_type) {
|
||||
case content::JAVASCRIPT_MESSAGE_TYPE_ALERT:
|
||||
buttons = GTK_BUTTONS_NONE;
|
||||
gtk_message_type = GTK_MESSAGE_WARNING;
|
||||
title = "JavaScript Alert";
|
||||
break;
|
||||
|
||||
case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM:
|
||||
buttons = GTK_BUTTONS_CANCEL;
|
||||
gtk_message_type = GTK_MESSAGE_QUESTION;
|
||||
title = "JavaScript Confirm";
|
||||
break;
|
||||
|
||||
case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT:
|
||||
buttons = GTK_BUTTONS_CANCEL;
|
||||
gtk_message_type = GTK_MESSAGE_QUESTION;
|
||||
title = "JavaScript Prompt";
|
||||
break;
|
||||
|
||||
default:
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
if (!display_url.empty()) {
|
||||
title += " - ";
|
||||
title += UTF16ToUTF8(display_url).c_str();
|
||||
}
|
||||
|
||||
GtkWidget* window =
|
||||
gtk_widget_get_ancestor(
|
||||
GTK_WIDGET(creator->browser()->GetWindowHandle()),
|
||||
GTK_TYPE_WINDOW);
|
||||
gtk_dialog_ = gtk_message_dialog_new(GTK_WINDOW(window),
|
||||
GTK_DIALOG_MODAL,
|
||||
gtk_message_type,
|
||||
buttons,
|
||||
"%s",
|
||||
UTF16ToUTF8(message_text).c_str());
|
||||
g_signal_connect(gtk_dialog_,
|
||||
"delete-event",
|
||||
G_CALLBACK(gtk_widget_hide_on_delete),
|
||||
NULL);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(gtk_dialog_), title.c_str());
|
||||
|
||||
GtkWidget* ok_button = gtk_dialog_add_button(GTK_DIALOG(gtk_dialog_),
|
||||
GTK_STOCK_OK,
|
||||
GTK_RESPONSE_OK);
|
||||
|
||||
if (message_type != content::JAVASCRIPT_MESSAGE_TYPE_PROMPT)
|
||||
gtk_widget_grab_focus(ok_button);
|
||||
|
||||
if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) {
|
||||
GtkWidget* content_area =
|
||||
gtk_dialog_get_content_area(GTK_DIALOG(gtk_dialog_));
|
||||
GtkWidget* text_box = gtk_entry_new();
|
||||
gtk_entry_set_text(GTK_ENTRY(text_box),
|
||||
UTF16ToUTF8(default_prompt_text).c_str());
|
||||
gtk_box_pack_start(GTK_BOX(content_area), text_box, TRUE, TRUE, 0);
|
||||
g_object_set_data(G_OBJECT(gtk_dialog_), kPromptTextId, text_box);
|
||||
gtk_entry_set_activates_default(GTK_ENTRY(text_box), TRUE);
|
||||
}
|
||||
|
||||
gtk_dialog_set_default_response(GTK_DIALOG(gtk_dialog_), GTK_RESPONSE_OK);
|
||||
g_signal_connect(gtk_dialog_, "response", G_CALLBACK(OnResponseThunk), this);
|
||||
gtk_widget_show_all(GTK_WIDGET(gtk_dialog_));
|
||||
}
|
||||
|
||||
CefJavaScriptDialog::~CefJavaScriptDialog() {
|
||||
}
|
||||
|
||||
void CefJavaScriptDialog::Cancel() {
|
||||
}
|
||||
|
||||
void CefJavaScriptDialog::OnResponse(GtkWidget* dialog, int response_id) {
|
||||
switch (response_id) {
|
||||
case GTK_RESPONSE_OK:
|
||||
callback_.Run(true, GetPromptText(GTK_DIALOG(dialog)));
|
||||
break;
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
case GTK_RESPONSE_DELETE_EVENT:
|
||||
callback_.Run(false, string16());
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
gtk_widget_destroy(dialog);
|
||||
|
||||
creator_->DialogClosed(this);
|
||||
}
|
@ -8,7 +8,6 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import "base/mac/cocoa_protocols.h"
|
||||
#import "base/memory/scoped_nsobject.h"
|
||||
#include "base/sys_string_conversions.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
|
@ -126,7 +126,7 @@ class CefResourceRequestJobCallback : public CefCallback {
|
||||
CefResourceRequestJob::CefResourceRequestJob(
|
||||
net::URLRequest* request,
|
||||
CefRefPtr<CefResourceHandler> handler)
|
||||
: net::URLRequestJob(request),
|
||||
: net::URLRequestJob(request, request->context()->network_delegate()),
|
||||
handler_(handler),
|
||||
remaining_bytes_(0),
|
||||
response_cookies_save_index_(0),
|
||||
|
@ -222,3 +222,7 @@ int CefNetworkDelegate::OnBeforeSocketStreamConnect(
|
||||
const net::CompletionCallback& callback) {
|
||||
return net::OK;
|
||||
}
|
||||
|
||||
void CefNetworkDelegate::OnCacheWaitStateChange(const net::URLRequest& request,
|
||||
CacheWaitState state) {
|
||||
}
|
||||
|
@ -57,6 +57,8 @@ class CefNetworkDelegate : public net::NetworkDelegate {
|
||||
virtual int OnBeforeSocketStreamConnect(
|
||||
net::SocketStream* stream,
|
||||
const net::CompletionCallback& callback) OVERRIDE;
|
||||
virtual void OnCacheWaitStateChange(const net::URLRequest& request,
|
||||
CacheWaitState state) OVERRIDE;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefNetworkDelegate);
|
||||
};
|
||||
|
@ -91,6 +91,15 @@ base::StringPiece CefContentClient::GetDataResource(
|
||||
return value;
|
||||
}
|
||||
|
||||
gfx::Image& CefContentClient::GetNativeImageNamed(int resource_id) const {
|
||||
gfx::Image& value =
|
||||
ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
|
||||
if (value.IsEmpty())
|
||||
LOG(ERROR) << "No native image available for id " << resource_id;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
FilePath CefContentClient::GetPathForResourcePack(
|
||||
const FilePath& pack_path,
|
||||
ui::ScaleFactor scale_factor) {
|
||||
|
@ -33,6 +33,7 @@ class CefContentClient : public content::ContentClient,
|
||||
virtual base::StringPiece GetDataResource(
|
||||
int resource_id,
|
||||
ui::ScaleFactor scale_factor) const OVERRIDE;
|
||||
virtual gfx::Image& GetNativeImageNamed(int resource_id) const OVERRIDE;
|
||||
|
||||
CefRefPtr<CefApp> application() const { return application_; }
|
||||
|
||||
|
@ -411,7 +411,7 @@ void CefMainDelegate::InitializeResourceBundle() {
|
||||
|
||||
if (file_util::PathExists(pak_file)) {
|
||||
content_client_.set_allow_pack_file_load(true);
|
||||
ResourceBundle::GetSharedInstance().AddDataPack(
|
||||
ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||
pak_file, ui::SCALE_FACTOR_NONE);
|
||||
content_client_.set_allow_pack_file_load(false);
|
||||
} else {
|
||||
|
@ -155,7 +155,7 @@ void CefRequestImpl::Set(net::URLRequest* request) {
|
||||
GetHeaderMap(headers, headermap_);
|
||||
|
||||
// Transfer post data, if any
|
||||
net::UploadData* data = request->get_upload();
|
||||
const net::UploadData* data = request->get_upload();
|
||||
if (data) {
|
||||
postdata_ = CefPostData::Create();
|
||||
static_cast<CefPostDataImpl*>(postdata_.get())->Set(*data);
|
||||
@ -401,13 +401,13 @@ void CefPostDataImpl::RemoveElements() {
|
||||
elements_.clear();
|
||||
}
|
||||
|
||||
void CefPostDataImpl::Set(net::UploadData& data) {
|
||||
void CefPostDataImpl::Set(const net::UploadData& data) {
|
||||
AutoLock lock_scope(this);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
|
||||
CefRefPtr<CefPostDataElement> postelem;
|
||||
|
||||
std::vector<net::UploadData::Element>* elements = data.elements();
|
||||
const std::vector<net::UploadData::Element>* elements = data.elements();
|
||||
std::vector<net::UploadData::Element>::const_iterator it = elements->begin();
|
||||
for (; it != elements->end(); ++it) {
|
||||
postelem = CefPostDataElement::Create();
|
||||
|
@ -94,7 +94,7 @@ class CefPostDataImpl : public CefPostData {
|
||||
virtual bool AddElement(CefRefPtr<CefPostDataElement> element) OVERRIDE;
|
||||
virtual void RemoveElements();
|
||||
|
||||
void Set(net::UploadData& data);
|
||||
void Set(const net::UploadData& data);
|
||||
void Get(net::UploadData& data);
|
||||
void Set(const WebKit::WebHTTPBody& data);
|
||||
void Get(WebKit::WebHTTPBody& data);
|
||||
|
@ -96,11 +96,13 @@ bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr<CefTask> task,
|
||||
if (id >= 0) {
|
||||
// Browser process.
|
||||
return CEF_POST_DELAYED_TASK(static_cast<BrowserThread::ID>(id),
|
||||
base::Bind(&CefTask::Execute, task, threadId), delay_ms);
|
||||
base::Bind(&CefTask::Execute, task, threadId),
|
||||
base::TimeDelta::FromMilliseconds(delay_ms));
|
||||
} else if (id == kRenderThreadId) {
|
||||
// Renderer process.
|
||||
return CEF_POST_DELAYED_TASK_RT(
|
||||
base::Bind(&CefTask::Execute, task, threadId), delay_ms);
|
||||
base::Bind(&CefTask::Execute, task, threadId),
|
||||
base::TimeDelta::FromMilliseconds(delay_ms));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ bool CefDictionaryValueImpl::Remove(const CefString& key) {
|
||||
CefValueType CefDictionaryValueImpl::GetType(const CefString& key) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, VTYPE_INVALID);
|
||||
|
||||
base::Value* out_value = NULL;
|
||||
const base::Value* out_value = NULL;
|
||||
if (const_value().GetWithoutPathExpansion(key, &out_value)) {
|
||||
switch (out_value->GetType()) {
|
||||
case base::Value::TYPE_NULL:
|
||||
@ -254,7 +254,7 @@ CefValueType CefDictionaryValueImpl::GetType(const CefString& key) {
|
||||
bool CefDictionaryValueImpl::GetBool(const CefString& key) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, false);
|
||||
|
||||
base::Value* out_value = NULL;
|
||||
const base::Value* out_value = NULL;
|
||||
bool ret_value = false;
|
||||
|
||||
if (const_value().GetWithoutPathExpansion(key, &out_value))
|
||||
@ -266,7 +266,7 @@ bool CefDictionaryValueImpl::GetBool(const CefString& key) {
|
||||
int CefDictionaryValueImpl::GetInt(const CefString& key) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, 0);
|
||||
|
||||
base::Value* out_value = NULL;
|
||||
const base::Value* out_value = NULL;
|
||||
int ret_value = 0;
|
||||
|
||||
if (const_value().GetWithoutPathExpansion(key, &out_value))
|
||||
@ -278,7 +278,7 @@ int CefDictionaryValueImpl::GetInt(const CefString& key) {
|
||||
double CefDictionaryValueImpl::GetDouble(const CefString& key) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, 0);
|
||||
|
||||
base::Value* out_value = NULL;
|
||||
const base::Value* out_value = NULL;
|
||||
double ret_value = 0;
|
||||
|
||||
if (const_value().GetWithoutPathExpansion(key, &out_value))
|
||||
@ -290,7 +290,7 @@ double CefDictionaryValueImpl::GetDouble(const CefString& key) {
|
||||
CefString CefDictionaryValueImpl::GetString(const CefString& key) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, CefString());
|
||||
|
||||
base::Value* out_value = NULL;
|
||||
const base::Value* out_value = NULL;
|
||||
string16 ret_value;
|
||||
|
||||
if (const_value().GetWithoutPathExpansion(key, &out_value))
|
||||
@ -303,12 +303,12 @@ CefRefPtr<CefBinaryValue> CefDictionaryValueImpl::GetBinary(
|
||||
const CefString& key) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
|
||||
base::Value* out_value = NULL;
|
||||
const base::Value* out_value = NULL;
|
||||
|
||||
if (const_value().GetWithoutPathExpansion(key, &out_value) &&
|
||||
out_value->IsType(base::Value::TYPE_BINARY)) {
|
||||
base::BinaryValue* binary_value =
|
||||
static_cast<base::BinaryValue*>(out_value);
|
||||
static_cast<base::BinaryValue*>(const_cast<base::Value*>(out_value));
|
||||
return CefBinaryValueImpl::GetOrCreateRef(binary_value,
|
||||
const_cast<base::DictionaryValue*>(&const_value()), controller());
|
||||
}
|
||||
@ -320,12 +320,13 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::GetDictionary(
|
||||
const CefString& key) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
|
||||
base::Value* out_value = NULL;
|
||||
const base::Value* out_value = NULL;
|
||||
|
||||
if (const_value().GetWithoutPathExpansion(key, &out_value) &&
|
||||
out_value->IsType(base::Value::TYPE_DICTIONARY)) {
|
||||
base::DictionaryValue* dict_value =
|
||||
static_cast<base::DictionaryValue*>(out_value);
|
||||
static_cast<base::DictionaryValue*>(
|
||||
const_cast<base::Value*>(out_value));
|
||||
return CefDictionaryValueImpl::GetOrCreateRef(
|
||||
dict_value,
|
||||
const_cast<base::DictionaryValue*>(&const_value()),
|
||||
@ -339,11 +340,12 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::GetDictionary(
|
||||
CefRefPtr<CefListValue> CefDictionaryValueImpl::GetList(const CefString& key) {
|
||||
CEF_VALUE_VERIFY_RETURN(false, NULL);
|
||||
|
||||
base::Value* out_value = NULL;
|
||||
const base::Value* out_value = NULL;
|
||||
|
||||
if (const_value().GetWithoutPathExpansion(key, &out_value) &&
|
||||
out_value->IsType(base::Value::TYPE_LIST)) {
|
||||
base::ListValue* list_value = static_cast<base::ListValue*>(out_value);
|
||||
base::ListValue* list_value =
|
||||
static_cast<base::ListValue*>(const_cast<base::Value*>(out_value));
|
||||
return CefListValueImpl::GetOrCreateRef(
|
||||
list_value,
|
||||
const_cast<base::DictionaryValue*>(&const_value()),
|
||||
|
@ -319,7 +319,7 @@ void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) {
|
||||
WebKit::WebHTTPBody body;
|
||||
body.initialize();
|
||||
|
||||
std::vector<net::UploadData::Element>* elements =
|
||||
const std::vector<net::UploadData::Element>* elements =
|
||||
params.upload_data->elements();
|
||||
std::vector<net::UploadData::Element>::const_iterator it =
|
||||
elements->begin();
|
||||
|
@ -528,7 +528,7 @@ bool CefV8ContextImpl::IsSame(CefRefPtr<CefV8Context> that) {
|
||||
bool CefV8ContextImpl::Eval(const CefString& code,
|
||||
CefRefPtr<CefV8Value>& retval,
|
||||
CefRefPtr<CefV8Exception>& exception) {
|
||||
CEF_REQUIRE_RT_RETURN(NULL);
|
||||
CEF_REQUIRE_RT_RETURN(false);
|
||||
|
||||
if (code.empty()) {
|
||||
NOTREACHED() << "invalid input parameter";
|
||||
@ -915,8 +915,8 @@ CefRefPtr<CefV8Exception> CefV8ValueImpl::GetException() {
|
||||
}
|
||||
|
||||
bool CefV8ValueImpl::ClearException() {
|
||||
CEF_REQUIRE_RT_RETURN(NULL);
|
||||
CEF_V8_REQUIRE_OBJECT_RETURN(NULL);
|
||||
CEF_REQUIRE_RT_RETURN(false);
|
||||
CEF_V8_REQUIRE_OBJECT_RETURN(false);
|
||||
|
||||
last_exception_ = NULL;
|
||||
return true;
|
||||
|
@ -1,17 +1,17 @@
|
||||
Index: resource_ids
|
||||
===================================================================
|
||||
--- resource_ids (revision 131752)
|
||||
--- resource_ids (revision 149431)
|
||||
+++ resource_ids (working copy)
|
||||
@@ -16,6 +16,12 @@
|
||||
{
|
||||
"SRCDIR": "../..",
|
||||
|
||||
+ "cef/libcef/resources/cef_resources.grd": {
|
||||
+ "includes": [26000],
|
||||
+ "includes": [27500],
|
||||
+ },
|
||||
+ "cef/libcef/resources/cef_strings.grd": {
|
||||
+ "messages": [26500],
|
||||
+ "messages": [28000],
|
||||
+ },
|
||||
"chrome/browser/browser_resources.grd": {
|
||||
"includes": [500],
|
||||
},
|
||||
"structures": [750],
|
||||
|
@ -38,7 +38,7 @@ gboolean GetSourceActivated(GtkWidget* widget) {
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Get Source... menu item.
|
||||
// Callback for Debug > Get Text... menu item.
|
||||
gboolean GetTextActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunGetTextTest(g_handler->GetBrowser());
|
||||
@ -86,6 +86,14 @@ gboolean BindingActivated(GtkWidget* widget) {
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > JavaScript Dialogs... menu item.
|
||||
gboolean DialogsActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunDialogTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Plugin Info... menu item.
|
||||
gboolean PluginInfoActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
@ -250,6 +258,8 @@ GtkWidget* CreateMenuBar() {
|
||||
G_CALLBACK(SchemeHandlerActivated));
|
||||
AddMenuEntry(debug_menu, "JavaScript Binding",
|
||||
G_CALLBACK(BindingActivated));
|
||||
AddMenuEntry(debug_menu, "JavaScript Dialogs",
|
||||
G_CALLBACK(DialogsActivated));
|
||||
AddMenuEntry(debug_menu, "Plugin Info",
|
||||
G_CALLBACK(PluginInfoActivated));
|
||||
AddMenuEntry(debug_menu, "DOM Access",
|
||||
@ -405,4 +415,4 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
std::string AppGetWorkingDirectory() {
|
||||
return szWorkingDir;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user