OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/push_messaging/push_messaging_message_filter.h" | 5 #include "content/browser/push_messaging/push_messaging_message_filter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 if (web_contents) { | 389 if (web_contents) { |
390 web_contents->GetMainFrame()->AddMessageToConsole( | 390 web_contents->GetMainFrame()->AddMessageToConsole( |
391 CONSOLE_MESSAGE_LEVEL_ERROR, kIncognitoPushUnsupportedMessage); | 391 CONSOLE_MESSAGE_LEVEL_ERROR, kIncognitoPushUnsupportedMessage); |
392 // Request push messaging permission (which will fail, since | 392 // Request push messaging permission (which will fail, since |
393 // notifications aren't supported in incognito), so the website can't | 393 // notifications aren't supported in incognito), so the website can't |
394 // detect whether incognito is active. | 394 // detect whether incognito is active. |
395 web_contents->GetBrowserContext() | 395 web_contents->GetBrowserContext() |
396 ->GetPermissionManager() | 396 ->GetPermissionManager() |
397 ->RequestPermission( | 397 ->RequestPermission( |
398 PermissionType::PUSH_MESSAGING, render_frame_host, | 398 PermissionType::PUSH_MESSAGING, render_frame_host, |
399 data.requesting_origin, | 399 data.requesting_origin, false /* user_gesture */, |
400 base::Bind(&PushMessagingMessageFilter::Core:: | 400 base::Bind(&PushMessagingMessageFilter::Core:: |
401 DidRequestPermissionInIncognito, | 401 DidRequestPermissionInIncognito, |
402 weak_factory_ui_to_ui_.GetWeakPtr(), data)); | 402 weak_factory_ui_to_ui_.GetWeakPtr(), data)); |
403 } | 403 } |
404 } | 404 } |
405 } | 405 } |
406 return; | 406 return; |
407 } | 407 } |
408 | 408 |
409 if (data.FromDocument()) { | 409 if (data.FromDocument()) { |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 PushMessagingService* PushMessagingMessageFilter::Core::service() { | 949 PushMessagingService* PushMessagingMessageFilter::Core::service() { |
950 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 950 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
951 RenderProcessHost* process_host = | 951 RenderProcessHost* process_host = |
952 RenderProcessHost::FromID(render_process_id_); | 952 RenderProcessHost::FromID(render_process_id_); |
953 return process_host | 953 return process_host |
954 ? process_host->GetBrowserContext()->GetPushMessagingService() | 954 ? process_host->GetBrowserContext()->GetPushMessagingService() |
955 : nullptr; | 955 : nullptr; |
956 } | 956 } |
957 | 957 |
958 } // namespace content | 958 } // namespace content |
OLD | NEW |