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

Side by Side Diff: chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc

Issue 1641563002: Remove linked_ptr usage in //base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase, really Created 4 years, 10 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 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 5
6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" 6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h"
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 if (!pending_menu_) 60 if (!pending_menu_)
61 return false; 61 return false;
62 62
63 // Pass it to embedder. 63 // Pass it to embedder.
64 int request_id = ++pending_context_menu_request_id_; 64 int request_id = ++pending_context_menu_request_id_;
65 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 65 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
66 scoped_ptr<base::ListValue> items = 66 scoped_ptr<base::ListValue> items =
67 MenuModelToValue(pending_menu_->menu_model()); 67 MenuModelToValue(pending_menu_->menu_model());
68 args->Set(webview::kContextMenuItems, items.release()); 68 args->Set(webview::kContextMenuItems, items.release());
69 args->SetInteger(webview::kRequestId, request_id); 69 args->SetInteger(webview::kRequestId, request_id);
70 web_view_guest()->DispatchEventToView( 70 web_view_guest()->DispatchEventToView(make_scoped_ptr(
71 new GuestViewEvent(webview::kEventContextMenuShow, std::move(args))); 71 new GuestViewEvent(webview::kEventContextMenuShow, std::move(args))));
72 return true; 72 return true;
73 } 73 }
74 74
75 void ChromeWebViewGuestDelegate::OnDidInitialize() { 75 void ChromeWebViewGuestDelegate::OnDidInitialize() {
76 #if defined(OS_CHROMEOS) 76 #if defined(OS_CHROMEOS)
77 chromeos::AccessibilityManager* accessibility_manager = 77 chromeos::AccessibilityManager* accessibility_manager =
78 chromeos::AccessibilityManager::Get(); 78 chromeos::AccessibilityManager::Get();
79 CHECK(accessibility_manager); 79 CHECK(accessibility_manager);
80 accessibility_subscription_ = accessibility_manager->RegisterCallback( 80 accessibility_subscription_ = accessibility_manager->RegisterCallback(
81 base::Bind(&ChromeWebViewGuestDelegate::OnAccessibilityStatusChanged, 81 base::Bind(&ChromeWebViewGuestDelegate::OnAccessibilityStatusChanged,
(...skipping 10 matching lines...) Expand all
92 // TODO(lazyboy): We need to expose some kind of enum equivalent of 92 // TODO(lazyboy): We need to expose some kind of enum equivalent of
93 // |command_id| instead of plain integers. 93 // |command_id| instead of plain integers.
94 item_value->SetInteger(webview::kMenuItemCommandId, 94 item_value->SetInteger(webview::kMenuItemCommandId,
95 menu_model.GetCommandIdAt(i)); 95 menu_model.GetCommandIdAt(i));
96 item_value->SetString(webview::kMenuItemLabel, menu_model.GetLabelAt(i)); 96 item_value->SetString(webview::kMenuItemLabel, menu_model.GetLabelAt(i));
97 items->Append(item_value); 97 items->Append(item_value);
98 } 98 }
99 return items; 99 return items;
100 } 100 }
101 101
102 void ChromeWebViewGuestDelegate::OnShowContextMenu( 102 void ChromeWebViewGuestDelegate::OnShowContextMenu(int request_id) {
103 int request_id, 103 if (!pending_menu_)
104 const MenuItemVector* items) {
105 if (!pending_menu_.get())
106 return; 104 return;
107 105
108 // Make sure this was the correct request. 106 // Make sure this was the correct request.
109 if (request_id != pending_context_menu_request_id_) 107 if (request_id != pending_context_menu_request_id_)
110 return; 108 return;
111 109
112 // TODO(lazyboy): Implement. 110 // TODO(lazyboy): Implement.
113 DCHECK(!items);
114 111
115 ContextMenuDelegate* menu_delegate = 112 ContextMenuDelegate* menu_delegate =
116 ContextMenuDelegate::FromWebContents(guest_web_contents()); 113 ContextMenuDelegate::FromWebContents(guest_web_contents());
117 menu_delegate->ShowMenu(std::move(pending_menu_)); 114 menu_delegate->ShowMenu(std::move(pending_menu_));
118 } 115 }
119 116
120 bool ChromeWebViewGuestDelegate::ShouldHandleFindRequestsForEmbedder() const { 117 bool ChromeWebViewGuestDelegate::ShouldHandleFindRequestsForEmbedder() const {
121 // Find requests will be handled by the guest for the Chrome signin page. 118 // Find requests will be handled by the guest for the Chrome signin page.
122 return web_view_guest_->owner_web_contents()->GetWebUI() != nullptr && 119 return web_view_guest_->owner_web_contents()->GetWebUI() != nullptr &&
123 web_view_guest_->GetOwnerSiteURL().GetOrigin().spec() == 120 web_view_guest_->GetOwnerSiteURL().GetOrigin().spec() ==
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 152
156 void ChromeWebViewGuestDelegate::SetContextMenuPosition( 153 void ChromeWebViewGuestDelegate::SetContextMenuPosition(
157 const gfx::Point& position) { 154 const gfx::Point& position) {
158 if (context_menu_position_ == nullptr) 155 if (context_menu_position_ == nullptr)
159 context_menu_position_.reset(new gfx::Point()); 156 context_menu_position_.reset(new gfx::Point());
160 157
161 *context_menu_position_ = position; 158 *context_menu_position_ = position;
162 } 159 }
163 160
164 } // namespace extensions 161 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698