Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: content/browser/service_worker/service_worker_provider_host.cc

Issue 1153793003: Add user_gesture param to WebContentsImpl::Activate Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update callers Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698