OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/service_worker/service_worker_provider_host.h" | 5 #include "content/browser/service_worker/service_worker_provider_host.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 return ServiceWorkerClientInfo(); | 43 return ServiceWorkerClientInfo(); |
44 | 44 |
45 FrameTreeNode* frame_tree_node = render_frame_host->frame_tree_node(); | 45 FrameTreeNode* frame_tree_node = render_frame_host->frame_tree_node(); |
46 | 46 |
47 // Focus the frame in the frame tree node, in case it has changed. | 47 // Focus the frame in the frame tree node, in case it has changed. |
48 frame_tree_node->frame_tree()->SetFocusedFrame(frame_tree_node); | 48 frame_tree_node->frame_tree()->SetFocusedFrame(frame_tree_node); |
49 | 49 |
50 // Focus the frame's view to make sure the frame is now considered as focused. | 50 // Focus the frame's view to make sure the frame is now considered as focused. |
51 render_frame_host->GetView()->Focus(); | 51 render_frame_host->GetView()->Focus(); |
52 | 52 |
53 // Move the web contents to the foreground. | 53 // Move the web contents to the foreground. Service Workers only allow focus() |
54 web_contents->Activate(); | 54 // to be called in reponse to a user gesture (e.g. notificationclick event). |
| 55 web_contents->Activate(true /* user_gesture */); |
55 | 56 |
56 return ServiceWorkerProviderHost::GetWindowClientInfoOnUI(render_process_id, | 57 return ServiceWorkerProviderHost::GetWindowClientInfoOnUI(render_process_id, |
57 render_frame_id); | 58 render_frame_id); |
58 } | 59 } |
59 | 60 |
60 } // anonymous namespace | 61 } // anonymous namespace |
61 | 62 |
62 ServiceWorkerProviderHost::OneShotGetReadyCallback::OneShotGetReadyCallback( | 63 ServiceWorkerProviderHost::OneShotGetReadyCallback::OneShotGetReadyCallback( |
63 const GetRegistrationForReadyCallback& callback) | 64 const GetRegistrationForReadyCallback& callback) |
64 : callback(callback), | 65 : callback(callback), |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 return context_ != NULL; | 651 return context_ != NULL; |
651 } | 652 } |
652 | 653 |
653 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { | 654 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { |
654 DCHECK(dispatcher_host_); | 655 DCHECK(dispatcher_host_); |
655 DCHECK(IsReadyToSendMessages()); | 656 DCHECK(IsReadyToSendMessages()); |
656 dispatcher_host_->Send(message); | 657 dispatcher_host_->Send(message); |
657 } | 658 } |
658 | 659 |
659 } // namespace content | 660 } // namespace content |
OLD | NEW |