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

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

Issue 1139193003: Speculative fix for ChromeWebViewGuestDelegate crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
9 #include "chrome/browser/favicon/favicon_helper.h" 9 #include "chrome/browser/favicon/favicon_helper.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ChromeWebViewGuestDelegate::~ChromeWebViewGuestDelegate() { 43 ChromeWebViewGuestDelegate::~ChromeWebViewGuestDelegate() {
44 } 44 }
45 45
46 bool ChromeWebViewGuestDelegate::HandleContextMenu( 46 bool ChromeWebViewGuestDelegate::HandleContextMenu(
47 const content::ContextMenuParams& params) { 47 const content::ContextMenuParams& params) {
48 ContextMenuDelegate* menu_delegate = 48 ContextMenuDelegate* menu_delegate =
49 ContextMenuDelegate::FromWebContents(guest_web_contents()); 49 ContextMenuDelegate::FromWebContents(guest_web_contents());
50 DCHECK(menu_delegate); 50 DCHECK(menu_delegate);
51 51
52 pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), params); 52 pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), params);
53 // It's possible for the returned menu to be null, so early out to avoid
54 // a crash. TODO(wjmaclean): find out why it's possible for this to happen
55 // in the first place, and if it's an error.
56 if (!pending_menu_)
57 return false;
53 58
54 // Pass it to embedder. 59 // Pass it to embedder.
55 int request_id = ++pending_context_menu_request_id_; 60 int request_id = ++pending_context_menu_request_id_;
56 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 61 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
57 scoped_ptr<base::ListValue> items = 62 scoped_ptr<base::ListValue> items =
58 MenuModelToValue(pending_menu_->menu_model()); 63 MenuModelToValue(pending_menu_->menu_model());
59 args->Set(webview::kContextMenuItems, items.release()); 64 args->Set(webview::kContextMenuItems, items.release());
60 args->SetInteger(webview::kRequestId, request_id); 65 args->SetInteger(webview::kRequestId, request_id);
61 web_view_guest()->DispatchEventToView( 66 web_view_guest()->DispatchEventToView(
62 new GuestViewEvent(webview::kEventContextMenuShow, args.Pass())); 67 new GuestViewEvent(webview::kEventContextMenuShow, args.Pass()));
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { 177 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) {
173 if (details.enabled) 178 if (details.enabled)
174 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost()); 179 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost());
175 else 180 else
176 chromevox_injected_ = false; 181 chromevox_injected_ = false;
177 } 182 }
178 } 183 }
179 #endif 184 #endif
180 185
181 } // namespace extensions 186 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698