mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02: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:
		@@ -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);
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user