OLD | NEW |
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 "chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate
_views.h" | 5 #include "chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate
_views.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/defaults.h" | 9 #include "chrome/browser/defaults.h" |
10 #include "chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.h" | 10 #include "chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // if the location bar was focused and the tab is dragged out), or it may | 112 // if the location bar was focused and the tab is dragged out), or it may |
113 // no longer be focusable (e.g. if the location bar was focused and then | 113 // no longer be focusable (e.g. if the location bar was focused and then |
114 // we switched to fullscreen mode). In that case we default to the | 114 // we switched to fullscreen mode). In that case we default to the |
115 // default focus. | 115 // default focus. |
116 SetInitialFocus(); | 116 SetInitialFocus(); |
117 } | 117 } |
118 view_storage->RemoveView(last_focused_view_storage_id_); | 118 view_storage->RemoveView(last_focused_view_storage_id_); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 scoped_ptr<RenderViewContextMenuBase> | 122 std::unique_ptr<RenderViewContextMenuBase> |
123 ChromeWebContentsViewDelegateViews::BuildMenu( | 123 ChromeWebContentsViewDelegateViews::BuildMenu( |
124 content::WebContents* web_contents, | 124 content::WebContents* web_contents, |
125 const content::ContextMenuParams& params) { | 125 const content::ContextMenuParams& params) { |
126 scoped_ptr<RenderViewContextMenuBase> menu; | 126 std::unique_ptr<RenderViewContextMenuBase> menu; |
127 content::RenderFrameHost* focused_frame = web_contents->GetFocusedFrame(); | 127 content::RenderFrameHost* focused_frame = web_contents->GetFocusedFrame(); |
128 // If the frame tree does not have a focused frame at this point, do not | 128 // If the frame tree does not have a focused frame at this point, do not |
129 // bother creating RenderViewContextMenuViews. | 129 // bother creating RenderViewContextMenuViews. |
130 // This happens if the frame has navigated to a different page before | 130 // This happens if the frame has navigated to a different page before |
131 // ContextMenu message was received by the current RenderFrameHost. | 131 // ContextMenu message was received by the current RenderFrameHost. |
132 if (focused_frame) { | 132 if (focused_frame) { |
133 menu.reset(RenderViewContextMenuViews::Create(focused_frame, params)); | 133 menu.reset(RenderViewContextMenuViews::Create(focused_frame, params)); |
134 menu->Init(); | 134 menu->Init(); |
135 } | 135 } |
136 return menu; | 136 return menu; |
137 } | 137 } |
138 | 138 |
139 void ChromeWebContentsViewDelegateViews::ShowMenu( | 139 void ChromeWebContentsViewDelegateViews::ShowMenu( |
140 scoped_ptr<RenderViewContextMenuBase> menu) { | 140 std::unique_ptr<RenderViewContextMenuBase> menu) { |
141 context_menu_ = std::move(menu); | 141 context_menu_ = std::move(menu); |
142 if (!context_menu_) | 142 if (!context_menu_) |
143 return; | 143 return; |
144 | 144 |
145 context_menu_->Show(); | 145 context_menu_->Show(); |
146 } | 146 } |
147 | 147 |
148 void ChromeWebContentsViewDelegateViews::ShowContextMenu( | 148 void ChromeWebContentsViewDelegateViews::ShowContextMenu( |
149 content::RenderFrameHost* render_frame_host, | 149 content::RenderFrameHost* render_frame_host, |
150 const content::ContextMenuParams& params) { | 150 const content::ContextMenuParams& params) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 218 } |
219 | 219 |
220 namespace chrome { | 220 namespace chrome { |
221 | 221 |
222 content::WebContentsViewDelegate* CreateWebContentsViewDelegate( | 222 content::WebContentsViewDelegate* CreateWebContentsViewDelegate( |
223 content::WebContents* web_contents) { | 223 content::WebContents* web_contents) { |
224 return new ChromeWebContentsViewDelegateViews(web_contents); | 224 return new ChromeWebContentsViewDelegateViews(web_contents); |
225 } | 225 } |
226 | 226 |
227 } // namespace chrome | 227 } // namespace chrome |
OLD | NEW |