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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2865653002: [Device Service] Decouple NFC implementation from //content (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 2633 matching lines...) Expand 10 before | Expand all | Expand 10 after
2644 return nullptr; 2644 return nullptr;
2645 } 2645 }
2646 wake_lock_context->GetWakeLock( 2646 wake_lock_context->GetWakeLock(
2647 device::mojom::WakeLockType::PreventDisplaySleep, 2647 device::mojom::WakeLockType::PreventDisplaySleep,
2648 device::mojom::WakeLockReason::ReasonOther, "Wake Lock API", 2648 device::mojom::WakeLockReason::ReasonOther, "Wake Lock API",
2649 mojo::MakeRequest(&renderer_wake_lock_)); 2649 mojo::MakeRequest(&renderer_wake_lock_));
2650 } 2650 }
2651 return renderer_wake_lock_.get(); 2651 return renderer_wake_lock_.get();
2652 } 2652 }
2653 2653
2654 #if defined(OS_ANDROID)
2655 void WebContentsImpl::GetNFC(device::nfc::mojom::NFCRequest request) {
2656 if (!nfc_host_)
2657 nfc_host_.reset(new NFCHost(this));
2658 nfc_host_->GetNFC(std::move(request));
2659 }
2660 #endif
2661
2654 void WebContentsImpl::OnShowValidationMessage( 2662 void WebContentsImpl::OnShowValidationMessage(
2655 RenderViewHostImpl* source, 2663 RenderViewHostImpl* source,
2656 const gfx::Rect& anchor_in_root_view, 2664 const gfx::Rect& anchor_in_root_view,
2657 const base::string16& main_text, 2665 const base::string16& main_text,
2658 const base::string16& sub_text) { 2666 const base::string16& sub_text) {
2659 // TODO(nick): Should we consider |source| here or pass it to the delegate? 2667 // TODO(nick): Should we consider |source| here or pass it to the delegate?
2660 if (delegate_) 2668 if (delegate_)
2661 delegate_->ShowValidationMessage( 2669 delegate_->ShowValidationMessage(
2662 this, anchor_in_root_view, main_text, sub_text); 2670 this, anchor_in_root_view, main_text, sub_text);
2663 } 2671 }
(...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after
4334 4342
4335 if (!render_frame_host->IsRenderFrameLive() || render_frame_host->GetParent()) 4343 if (!render_frame_host->IsRenderFrameLive() || render_frame_host->GetParent())
4336 return; 4344 return;
4337 4345
4338 NavigationEntry* entry = controller_.GetPendingEntry(); 4346 NavigationEntry* entry = controller_.GetPendingEntry();
4339 if (entry && entry->IsViewSourceMode()) { 4347 if (entry && entry->IsViewSourceMode()) {
4340 // Put the renderer in view source mode. 4348 // Put the renderer in view source mode.
4341 render_frame_host->Send( 4349 render_frame_host->Send(
4342 new FrameMsg_EnableViewSourceMode(render_frame_host->GetRoutingID())); 4350 new FrameMsg_EnableViewSourceMode(render_frame_host->GetRoutingID()));
4343 } 4351 }
4344 #if defined(OS_ANDROID)
4345 render_frame_host->GetInterfaceRegistry()->AddInterface(
4346 GetJavaInterfaces()->CreateInterfaceFactory<device::nfc::mojom::NFC>());
4347 #endif
4348 } 4352 }
4349 4353
4350 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { 4354 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) {
4351 is_notifying_observers_ = true; 4355 is_notifying_observers_ = true;
4352 for (auto& observer : observers_) 4356 for (auto& observer : observers_)
4353 observer.RenderFrameDeleted(render_frame_host); 4357 observer.RenderFrameDeleted(render_frame_host);
4354 is_notifying_observers_ = false; 4358 is_notifying_observers_ = false;
4355 #if BUILDFLAG(ENABLE_PLUGINS) 4359 #if BUILDFLAG(ENABLE_PLUGINS)
4356 pepper_playback_observer_->RenderFrameDeleted(render_frame_host); 4360 pepper_playback_observer_->RenderFrameDeleted(render_frame_host);
4357 #endif 4361 #endif
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
5627 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); 5631 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5628 if (!render_view_host) 5632 if (!render_view_host)
5629 continue; 5633 continue;
5630 render_view_host_set.insert(render_view_host); 5634 render_view_host_set.insert(render_view_host);
5631 } 5635 }
5632 for (RenderViewHost* render_view_host : render_view_host_set) 5636 for (RenderViewHost* render_view_host : render_view_host_set)
5633 render_view_host->OnWebkitPreferencesChanged(); 5637 render_view_host->OnWebkitPreferencesChanged();
5634 } 5638 }
5635 5639
5636 } // namespace content 5640 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698