Merge branch 'master' into roller/chromium/master
This commit is contained in:
parent
8f4e362d8f
commit
57a8781c01
137 changed files with 876 additions and 4289 deletions
|
@ -47,6 +47,27 @@ void BadgeManager::BindFrameReceiver(
|
|||
std::move(context));
|
||||
}
|
||||
|
||||
void BadgeManager::BindServiceWorkerReceiver(
|
||||
content::RenderProcessHost* service_worker_process_host,
|
||||
const GURL& service_worker_scope,
|
||||
mojo::PendingReceiver<blink::mojom::BadgeService> receiver) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
auto* browser_context = service_worker_process_host->GetBrowserContext();
|
||||
|
||||
auto* badge_manager =
|
||||
badging::BadgeManagerFactory::GetInstance()->GetForBrowserContext(
|
||||
browser_context);
|
||||
if (!badge_manager)
|
||||
return;
|
||||
|
||||
auto context = std::make_unique<BadgeManager::ServiceWorkerBindingContext>(
|
||||
service_worker_process_host->GetID(), service_worker_scope);
|
||||
|
||||
badge_manager->receivers_.Add(badge_manager, std::move(receiver),
|
||||
std::move(context));
|
||||
}
|
||||
|
||||
std::string BadgeManager::GetBadgeString(base::Optional<int> badge_content) {
|
||||
if (!badge_content)
|
||||
return "•";
|
||||
|
|
|
@ -37,6 +37,10 @@ class BadgeManager : public KeyedService, public blink::mojom::BadgeService {
|
|||
static void BindFrameReceiver(
|
||||
content::RenderFrameHost* frame,
|
||||
mojo::PendingReceiver<blink::mojom::BadgeService> receiver);
|
||||
static void BindServiceWorkerReceiver(
|
||||
content::RenderProcessHost* service_worker_process_host,
|
||||
const GURL& service_worker_scope,
|
||||
mojo::PendingReceiver<blink::mojom::BadgeService> receiver);
|
||||
|
||||
// Determines the text to put on the badge based on some badge_content.
|
||||
static std::string GetBadgeString(base::Optional<int> badge_content);
|
||||
|
@ -66,6 +70,21 @@ class BadgeManager : public KeyedService, public blink::mojom::BadgeService {
|
|||
int frame_id_;
|
||||
};
|
||||
|
||||
// The BindingContext for ServiceWorkerGlobalScope execution contexts.
|
||||
class ServiceWorkerBindingContext final : public BindingContext {
|
||||
public:
|
||||
ServiceWorkerBindingContext(int process_id, const GURL& scope)
|
||||
: process_id_(process_id), scope_(scope) {}
|
||||
~ServiceWorkerBindingContext() override = default;
|
||||
|
||||
int GetProcessId() { return process_id_; }
|
||||
GURL GetScope() { return scope_; }
|
||||
|
||||
private:
|
||||
int process_id_;
|
||||
GURL scope_;
|
||||
};
|
||||
|
||||
// blink::mojom::BadgeService:
|
||||
// Note: These are private to stop them being called outside of mojo as they
|
||||
// require a mojo binding context.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue