Skip to content

Commit

Permalink
[chromecast] Fix broken build due to permission manager interface.
Browse files Browse the repository at this point in the history
Review URL: https://codereview.chromium.org/1042493003

Cr-Commit-Position: refs/heads/master@{#322850}
  • Loading branch information
gfhuang authored and Commit bot committed Mar 30, 2015
1 parent bee8ad8 commit 7545689
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 32 deletions.
7 changes: 7 additions & 0 deletions chromecast/browser/cast_browser_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "base/macros.h"
#include "base/path_service.h"
#include "chromecast/browser/cast_download_manager_delegate.h"
#include "chromecast/browser/cast_permission_manager.h"
#include "chromecast/browser/url_request_context_factory.h"
#include "chromecast/common/cast_paths.h"
#include "content/public/browser/browser_thread.h"
Expand Down Expand Up @@ -149,5 +150,11 @@ content::SSLHostStateDelegate* CastBrowserContext::GetSSLHostStateDelegate() {
return NULL;
}

content::PermissionManager* CastBrowserContext::GetPermissionManager() {
if (!permission_manager_.get())
permission_manager_.reset(new CastPermissionManager());
return permission_manager_.get();
}

} // namespace shell
} // namespace chromecast
2 changes: 2 additions & 0 deletions chromecast/browser/cast_browser_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class CastBrowserContext : public content::BrowserContext {
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
content::PushMessagingService* GetPushMessagingService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override;

net::URLRequestContextGetter* GetSystemRequestContext();

Expand All @@ -59,6 +60,7 @@ class CastBrowserContext : public content::BrowserContext {
base::FilePath path_;
scoped_ptr<CastResourceContext> resource_context_;
scoped_ptr<CastDownloadManagerDelegate> download_manager_delegate_;
scoped_ptr<content::PermissionManager> permission_manager_;

DISALLOW_COPY_AND_ASSIGN(CastBrowserContext);
};
Expand Down
20 changes: 0 additions & 20 deletions chromecast/browser/cast_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,26 +253,6 @@ CastContentBrowserClient::SelectClientCertificateOnIOThread(
}
}

void CastContentBrowserClient::RequestPermission(
content::PermissionType permission,
content::WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
const base::Callback<void(content::PermissionStatus)>& callback) {
LOG(INFO) << __FUNCTION__ << ": " << static_cast<int>(permission);
callback.Run(content::PermissionStatus::PERMISSION_STATUS_GRANTED);
}

content::PermissionStatus CastContentBrowserClient::GetPermissionStatus(
content::PermissionType permission,
content::BrowserContext* browser_context,
const GURL& requesting_origin,
const GURL& embedding_origin) {
LOG(INFO) << __FUNCTION__ << ": " << static_cast<int>(permission);
return content::PermissionStatus::PERMISSION_STATUS_GRANTED;
}

bool CastContentBrowserClient::CanCreateWindow(
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
Expand Down
12 changes: 0 additions & 12 deletions chromecast/browser/cast_content_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,6 @@ class CastContentBrowserClient: public content::ContentBrowserClient {
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
scoped_ptr<content::ClientCertificateDelegate> delegate) override;
void RequestPermission(
content::PermissionType permission,
content::WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
const base::Callback<void(content::PermissionStatus)>& callback) override;
content::PermissionStatus GetPermissionStatus(
content::PermissionType permission,
content::BrowserContext* browser_context,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
bool CanCreateWindow(
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
Expand Down
59 changes: 59 additions & 0 deletions chromecast/browser/cast_permission_manager.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2015 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 "chromecast/browser/cast_permission_manager.h"

#include "base/callback.h"
#include "content/public/browser/permission_type.h"

namespace chromecast {
namespace shell {

CastPermissionManager::CastPermissionManager()
: content::PermissionManager() {
}

CastPermissionManager::~CastPermissionManager() {
}

void CastPermissionManager::RequestPermission(
content::PermissionType permission,
content::WebContents* web_contents,
int request_id,
const GURL& origin,
bool user_gesture,
const base::Callback<void(content::PermissionStatus)>& callback) {
LOG(INFO) << __FUNCTION__ << ": " << static_cast<int>(permission);
callback.Run(content::PermissionStatus::PERMISSION_STATUS_GRANTED);
}

void CastPermissionManager::CancelPermissionRequest(
content::PermissionType permission,
content::WebContents* web_contents,
int request_id,
const GURL& origin) {
}

void CastPermissionManager::ResetPermission(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
}

content::PermissionStatus CastPermissionManager::GetPermissionStatus(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
LOG(INFO) << __FUNCTION__ << ": " << static_cast<int>(permission);
return content::PermissionStatus::PERMISSION_STATUS_GRANTED;
}

void CastPermissionManager::RegisterPermissionUsage(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
}

} // namespace shell
} // namespace chromecast
50 changes: 50 additions & 0 deletions chromecast/browser/cast_permission_manager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2015 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.

#ifndef CHROMECAST_BROWSER_CAST_PERMISSION_MANAGER_H_
#define CHROMECAST_BROWSER_CAST_PERMISSION_MANAGER_H_

#include "base/callback_forward.h"
#include "base/macros.h"
#include "content/public/browser/permission_manager.h"

namespace chromecast {
namespace shell {

class CastPermissionManager : public content::PermissionManager {
public:
CastPermissionManager();
~CastPermissionManager() override;

// content::PermissionManager implementation:
void RequestPermission(
content::PermissionType permission,
content::WebContents* web_contents,
int request_id,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(content::PermissionStatus)>& callback) override;
void CancelPermissionRequest(content::PermissionType permission,
content::WebContents* web_contents,
int request_id,
const GURL& requesting_origin) override;
void ResetPermission(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
content::PermissionStatus GetPermissionStatus(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
void RegisterPermissionUsage(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;

private:
DISALLOW_COPY_AND_ASSIGN(CastPermissionManager);
};

} // namespace shell
} // namespace chromecast

#endif // CHROMECAST_BROWSER_CAST_PERMISSION_MANAGER_H_
2 changes: 2 additions & 0 deletions chromecast/chromecast.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@
'browser/cast_http_user_agent_settings.h',
'browser/cast_network_delegate.cc',
'browser/cast_network_delegate.h',
'browser/cast_permission_manager.cc',
'browser/cast_permission_manager.h',
'browser/cast_resource_dispatcher_host_delegate.cc',
'browser/cast_resource_dispatcher_host_delegate.h',
'browser/devtools/cast_dev_tools_delegate.cc',
Expand Down

0 comments on commit 7545689

Please sign in to comment.