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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 197533008: Mac: ExternalPopupMenu::close should hide a showing popup menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fix Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/test/test_web_contents_view.h » ('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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 4891 matching lines...) Expand 10 before | Expand all | Expand 10 after
4902 media_player_manager_, 4902 media_player_manager_,
4903 stream_texture_factory.release(), 4903 stream_texture_factory.release(),
4904 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), 4904 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(),
4905 new RenderMediaLog()); 4905 new RenderMediaLog());
4906 } 4906 }
4907 4907
4908 #endif // defined(OS_ANDROID) 4908 #endif // defined(OS_ANDROID)
4909 4909
4910 #if defined(OS_MACOSX) 4910 #if defined(OS_MACOSX)
4911 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) { 4911 void RenderViewImpl::OnSelectPopupMenuItem(int selected_index) {
4912 if (external_popup_menu_ == NULL) { 4912 if (external_popup_menu_ == NULL)
4913 // Crash reports from the field indicate that we can be notified with a
4914 // NULL external popup menu (we probably get notified twice).
4915 // If you hit this please file a bug against jcivelli and include the page
4916 // and steps to repro.
4917 NOTREACHED();
4918 return; 4913 return;
4919 }
4920 external_popup_menu_->DidSelectItem(selected_index); 4914 external_popup_menu_->DidSelectItem(selected_index);
4921 external_popup_menu_.reset(); 4915 external_popup_menu_.reset();
4922 } 4916 }
4923 #endif 4917 #endif
4924 4918
4925 #if defined(OS_ANDROID) 4919 #if defined(OS_ANDROID)
4926 void RenderViewImpl::OnSelectPopupMenuItems( 4920 void RenderViewImpl::OnSelectPopupMenuItems(
4927 bool canceled, 4921 bool canceled,
4928 const std::vector<int>& selected_indices) { 4922 const std::vector<int>& selected_indices) {
4929 // It is possible to receive more than one of these calls if the user presses 4923 // It is possible to receive more than one of these calls if the user presses
4930 // a select faster than it takes for the show-select-popup IPC message to make 4924 // a select faster than it takes for the show-select-popup IPC message to make
4931 // it to the browser UI thread. Ignore the extra-messages. 4925 // it to the browser UI thread. Ignore the extra-messages.
4932 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. 4926 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug.
4933 if (!external_popup_menu_) 4927 if (!external_popup_menu_)
4934 return; 4928 return;
4935 4929
4936 external_popup_menu_->DidSelectItems(canceled, selected_indices); 4930 external_popup_menu_->DidSelectItems(canceled, selected_indices);
4937 external_popup_menu_.reset(); 4931 external_popup_menu_.reset();
4938 } 4932 }
4939 #endif 4933 #endif
4940 4934
4935 void RenderViewImpl::DidHideExternalPopupMenu() {
4936 // We need to clear external_popup_menu_ as soon as ExternalPopupMenu::close
4937 // is called. Otherwise, createExternalPopupMenu() for new popup will fail.
4938 external_popup_menu_.reset();
4939 }
4940
4941 void RenderViewImpl::OnShowContextMenu(const gfx::Point& location) { 4941 void RenderViewImpl::OnShowContextMenu(const gfx::Point& location) {
4942 context_menu_source_type_ = ui::MENU_SOURCE_TOUCH_EDIT_MENU; 4942 context_menu_source_type_ = ui::MENU_SOURCE_TOUCH_EDIT_MENU;
4943 touch_editing_context_menu_location_ = location; 4943 touch_editing_context_menu_location_ = location;
4944 if (webview()) 4944 if (webview())
4945 webview()->showContextMenu(); 4945 webview()->showContextMenu();
4946 } 4946 }
4947 4947
4948 void RenderViewImpl::OnEnableViewSourceMode() { 4948 void RenderViewImpl::OnEnableViewSourceMode() {
4949 if (!webview()) 4949 if (!webview())
4950 return; 4950 return;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
5127 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); 5127 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size());
5128 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 5128 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
5129 if (!url.isEmpty()) 5129 if (!url.isEmpty())
5130 urls.push_back( 5130 urls.push_back(
5131 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 5131 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
5132 } 5132 }
5133 SendUpdateFaviconURL(urls); 5133 SendUpdateFaviconURL(urls);
5134 } 5134 }
5135 5135
5136 } // namespace content 5136 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/test/test_web_contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698