Fix API changes of Chrome 58

This commit is contained in:
Cheng Zhao 2017-04-04 13:43:49 +09:00
parent 0a110a44f9
commit c41fb922b3
13 changed files with 14 additions and 49 deletions

View file

@ -15,7 +15,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "media/base/media_resources.h" #include "media/base/localized_strings.h"
#include "net/proxy/proxy_resolver_v8.h" #include "net/proxy/proxy_resolver_v8.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/material_design/material_design_controller.h" #include "ui/base/material_design/material_design_controller.h"

View file

@ -194,7 +194,6 @@ DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(
d->RegisterHandler("dispatchProtocolMessage", d->RegisterHandler("dispatchProtocolMessage",
&Delegate::DispatchProtocolMessageFromDevToolsFrontend, &Delegate::DispatchProtocolMessageFromDevToolsFrontend,
delegate); delegate);
d->RegisterHandler("recordActionUMA", &Delegate::RecordActionUMA, delegate);
d->RegisterHandlerWithCallback("sendJsonRequest", d->RegisterHandlerWithCallback("sendJsonRequest",
&Delegate::SendJsonRequest, delegate); &Delegate::SendJsonRequest, delegate);
d->RegisterHandlerWithCallback("getPreferences", d->RegisterHandlerWithCallback("getPreferences",

View file

@ -70,7 +70,6 @@ class DevToolsEmbedderMessageDispatcher {
virtual void SetDevicesUpdatesEnabled(bool enabled) = 0; virtual void SetDevicesUpdatesEnabled(bool enabled) = 0;
virtual void DispatchProtocolMessageFromDevToolsFrontend( virtual void DispatchProtocolMessageFromDevToolsFrontend(
const std::string& message) = 0; const std::string& message) = 0;
virtual void RecordActionUMA(const std::string& name, int action) = 0;
virtual void SendJsonRequest(const DispatchCallback& callback, virtual void SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id, const std::string& browser_id,
const std::string& url) = 0; const std::string& url) = 0;

View file

@ -61,11 +61,6 @@ const char kFrontendHostMethod[] = "method";
const char kFrontendHostParams[] = "params"; const char kFrontendHostParams[] = "params";
const char kTitleFormat[] = "Developer Tools - %s"; const char kTitleFormat[] = "Developer Tools - %s";
const char kDevToolsActionTakenHistogram[] = "DevTools.ActionTaken";
const int kDevToolsActionTakenBoundary = 100;
const char kDevToolsPanelShownHistogram[] = "DevTools.PanelShown";
const int kDevToolsPanelShownBoundary = 20;
const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
void RectToDictionary(const gfx::Rect& bounds, base::DictionaryValue* dict) { void RectToDictionary(const gfx::Rect& bounds, base::DictionaryValue* dict) {
@ -171,7 +166,7 @@ int ResponseWriter::Initialize(const net::CompletionCallback& callback) {
int ResponseWriter::Write(net::IOBuffer* buffer, int ResponseWriter::Write(net::IOBuffer* buffer,
int num_bytes, int num_bytes,
const net::CompletionCallback& callback) { const net::CompletionCallback& callback) {
auto* id = new base::FundamentalValue(stream_id_); auto* id = new base::Value(stream_id_);
base::StringValue* chunk = base::StringValue* chunk =
new base::StringValue(std::string(buffer->data(), num_bytes)); new base::StringValue(std::string(buffer->data(), num_bytes));
@ -563,14 +558,6 @@ void InspectableWebContentsImpl::DispatchProtocolMessageFromDevToolsFrontend(
agent_host_->DispatchProtocolMessage(this, message); agent_host_->DispatchProtocolMessage(this, message);
} }
void InspectableWebContentsImpl::RecordActionUMA(const std::string& name,
int action) {
if (name == kDevToolsActionTakenHistogram)
UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsActionTakenBoundary);
else if (name == kDevToolsPanelShownHistogram)
UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsPanelShownBoundary);
}
void InspectableWebContentsImpl::SendJsonRequest( void InspectableWebContentsImpl::SendJsonRequest(
const DispatchCallback& callback, const DispatchCallback& callback,
const std::string& browser_id, const std::string& browser_id,
@ -639,7 +626,7 @@ void InspectableWebContentsImpl::DispatchProtocolMessage(
return; return;
} }
base::FundamentalValue total_size(static_cast<int>(message.length())); base::Value total_size(static_cast<int>(message.length()));
for (size_t pos = 0; pos < message.length(); pos += kMaxMessageChunkSize) { for (size_t pos = 0; pos < message.length(); pos += kMaxMessageChunkSize) {
base::StringValue message_value(message.substr(pos, kMaxMessageChunkSize)); base::StringValue message_value(message.substr(pos, kMaxMessageChunkSize));
CallClientFunction("DevToolsAPI.dispatchMessageChunk", CallClientFunction("DevToolsAPI.dispatchMessageChunk",
@ -686,10 +673,12 @@ bool InspectableWebContentsImpl::DidAddMessageToConsole(
bool InspectableWebContentsImpl::ShouldCreateWebContents( bool InspectableWebContentsImpl::ShouldCreateWebContents(
content::WebContents* web_contents, content::WebContents* web_contents,
content::SiteInstance* source_site_instance,
int32_t route_id, int32_t route_id,
int32_t main_frame_route_id, int32_t main_frame_route_id,
int32_t main_frame_widget_route_id, int32_t main_frame_widget_route_id,
content::mojom::WindowContainerType window_container_type, content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name, const std::string& frame_name,
const GURL& target_url, const GURL& target_url,
const std::string& partition_id, const std::string& partition_id,
@ -777,7 +766,7 @@ void InspectableWebContentsImpl::OnURLFetchComplete(
void InspectableWebContentsImpl::SendMessageAck(int request_id, void InspectableWebContentsImpl::SendMessageAck(int request_id,
const base::Value* arg) { const base::Value* arg) {
base::FundamentalValue id_value(request_id); base::Value id_value(request_id);
CallClientFunction("DevToolsAPI.embedderMessageAck", CallClientFunction("DevToolsAPI.embedderMessageAck",
&id_value, arg, nullptr); &id_value, arg, nullptr);
} }

View file

@ -107,7 +107,6 @@ class InspectableWebContentsImpl :
void SetDevicesUpdatesEnabled(bool enabled) override; void SetDevicesUpdatesEnabled(bool enabled) override;
void DispatchProtocolMessageFromDevToolsFrontend( void DispatchProtocolMessageFromDevToolsFrontend(
const std::string& message) override; const std::string& message) override;
void RecordActionUMA(const std::string& name, int action) override;
void SendJsonRequest(const DispatchCallback& callback, void SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id, const std::string& browser_id,
const std::string& url) override; const std::string& url) override;
@ -143,10 +142,12 @@ class InspectableWebContentsImpl :
const base::string16& source_id) override; const base::string16& source_id) override;
bool ShouldCreateWebContents( bool ShouldCreateWebContents(
content::WebContents* web_contents, content::WebContents* web_contents,
content::SiteInstance* source_site_instance,
int32_t route_id, int32_t route_id,
int32_t main_frame_route_id, int32_t main_frame_route_id,
int32_t main_frame_widget_route_id, int32_t main_frame_widget_route_id,
content::mojom::WindowContainerType window_container_type, content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name, const std::string& frame_name,
const GURL& target_url, const GURL& target_url,
const std::string& partition_id, const std::string& partition_id,

View file

@ -134,14 +134,6 @@ bool NetworkDelegate::OnCanEnablePrivacyMode(
return false; return false;
} }
bool NetworkDelegate::OnAreStrictSecureCookiesEnabled() const {
return true;
}
bool NetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
return true;
}
bool NetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( bool NetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader(
const net::URLRequest& request, const net::URLRequest& request,
const GURL& target_url, const GURL& target_url,

View file

@ -63,7 +63,6 @@ class NetworkDelegate : public net::NetworkDelegate {
bool OnCanEnablePrivacyMode( bool OnCanEnablePrivacyMode(
const GURL& url, const GURL& url,
const GURL& first_party_for_cookies) const override; const GURL& first_party_for_cookies) const override;
bool OnAreStrictSecureCookiesEnabled() const override;
bool OnAreExperimentalCookieFeaturesEnabled() const override; bool OnAreExperimentalCookieFeaturesEnabled() const override;
bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
const net::URLRequest& request, const net::URLRequest& request,

View file

@ -70,12 +70,6 @@ blink::mojom::PermissionStatus PermissionManager::GetPermissionStatus(
return blink::mojom::PermissionStatus::GRANTED; return blink::mojom::PermissionStatus::GRANTED;
} }
void PermissionManager::RegisterPermissionUsage(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
}
int PermissionManager::SubscribePermissionStatusChange( int PermissionManager::SubscribePermissionStatusChange(
content::PermissionType permission, content::PermissionType permission,
const GURL& requesting_origin, const GURL& requesting_origin,

View file

@ -40,9 +40,6 @@ class PermissionManager : public content::PermissionManager {
content::PermissionType permission, content::PermissionType permission,
const GURL& requesting_origin, const GURL& requesting_origin,
const GURL& embedding_origin) override; const GURL& embedding_origin) override;
void RegisterPermissionUsage(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
int SubscribePermissionStatusChange( int SubscribePermissionStatusChange(
content::PermissionType permission, content::PermissionType permission,
const GURL& requesting_origin, const GURL& requesting_origin,

View file

@ -100,7 +100,7 @@ void PlatformNotificationService::ClosePersistentNotification(
const std::string& notification_id) { const std::string& notification_id) {
} }
bool PlatformNotificationService::GetDisplayedPersistentNotifications( bool PlatformNotificationService::GetDisplayedNotifications(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
std::set<std::string>* displayed_notifications) { std::set<std::string>* displayed_notifications) {
return false; return false;

View file

@ -45,7 +45,7 @@ class PlatformNotificationService
const content::NotificationResources& notification_resources) override; const content::NotificationResources& notification_resources) override;
void ClosePersistentNotification(content::BrowserContext* browser_context, void ClosePersistentNotification(content::BrowserContext* browser_context,
const std::string& notification_id) override; const std::string& notification_id) override;
bool GetDisplayedPersistentNotifications( bool GetDisplayedNotifications(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
std::set<std::string>* displayed_notifications) override; std::set<std::string>* displayed_notifications) override;

View file

@ -24,20 +24,16 @@ bool SpecialStoragePolicy::IsStorageDurable(const GURL& origin) {
return true; return true;
} }
bool SpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) { bool SpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) {
return false; return false;
} }
bool SpecialStoragePolicy::CanQueryDiskSize(const GURL& origin) { bool SpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
return true; return false;
} }
bool SpecialStoragePolicy::HasSessionOnlyOrigins() { bool SpecialStoragePolicy::HasSessionOnlyOrigins() {
return false; return false;
} }
bool SpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) {
return false;
}
} // namespace brightray } // namespace brightray

View file

@ -17,9 +17,8 @@ class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
bool IsStorageProtected(const GURL& origin) override; bool IsStorageProtected(const GURL& origin) override;
bool IsStorageUnlimited(const GURL& origin) override; bool IsStorageUnlimited(const GURL& origin) override;
bool IsStorageDurable(const GURL& origin) override; bool IsStorageDurable(const GURL& origin) override;
bool IsStorageSessionOnly(const GURL& origin) override;
bool CanQueryDiskSize(const GURL& origin) override;
bool HasIsolatedStorage(const GURL& origin) override; bool HasIsolatedStorage(const GURL& origin) override;
bool IsStorageSessionOnly(const GURL& origin) override;
bool HasSessionOnlyOrigins() override; bool HasSessionOnlyOrigins() override;
protected: protected: