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 "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 #if defined(OS_WIN) | 243 #if defined(OS_WIN) |
244 // Fill out the OSExchangeData with a file contents, synthesizing a name if | 244 // Fill out the OSExchangeData with a file contents, synthesizing a name if |
245 // necessary. | 245 // necessary. |
246 void PrepareDragForFileContents(const DropData& drop_data, | 246 void PrepareDragForFileContents(const DropData& drop_data, |
247 ui::OSExchangeData::Provider* provider) { | 247 ui::OSExchangeData::Provider* provider) { |
248 base::FilePath file_name(drop_data.file_description_filename); | 248 base::FilePath file_name(drop_data.file_description_filename); |
249 // Images without ALT text will only have a file extension so we need to | 249 // Images without ALT text will only have a file extension so we need to |
250 // synthesize one from the provided extension and URL. | 250 // synthesize one from the provided extension and URL. |
251 if (file_name.BaseName().RemoveExtension().empty()) { | 251 if (file_name.BaseName().RemoveExtension().empty()) { |
252 const string16 extension = file_name.Extension(); | 252 const base::string16 extension = file_name.Extension(); |
253 // Retrieve the name from the URL. | 253 // Retrieve the name from the URL. |
254 file_name = base::FilePath(net::GetSuggestedFilename( | 254 file_name = base::FilePath(net::GetSuggestedFilename( |
255 drop_data.url, "", "", "", "", "")).ReplaceExtension(extension); | 255 drop_data.url, "", "", "", "", "")).ReplaceExtension(extension); |
256 } | 256 } |
257 provider->SetFileContents(file_name, drop_data.file_contents); | 257 provider->SetFileContents(file_name, drop_data.file_contents); |
258 } | 258 } |
259 #endif | 259 #endif |
260 | 260 |
261 // Utility to fill a ui::OSExchangeDataProvider object from DropData. | 261 // Utility to fill a ui::OSExchangeDataProvider object from DropData. |
262 void PrepareDragData(const DropData& drop_data, | 262 void PrepareDragData(const DropData& drop_data, |
(...skipping 26 matching lines...) Expand all Loading... |
289 if (!drop_data.custom_data.empty()) { | 289 if (!drop_data.custom_data.empty()) { |
290 Pickle pickle; | 290 Pickle pickle; |
291 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); | 291 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); |
292 provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), | 292 provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), |
293 pickle); | 293 pickle); |
294 } | 294 } |
295 } | 295 } |
296 | 296 |
297 // Utility to fill a DropData object from ui::OSExchangeData. | 297 // Utility to fill a DropData object from ui::OSExchangeData. |
298 void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) { | 298 void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) { |
299 string16 plain_text; | 299 base::string16 plain_text; |
300 data.GetString(&plain_text); | 300 data.GetString(&plain_text); |
301 if (!plain_text.empty()) | 301 if (!plain_text.empty()) |
302 drop_data->text = base::NullableString16(plain_text, false); | 302 drop_data->text = base::NullableString16(plain_text, false); |
303 | 303 |
304 GURL url; | 304 GURL url; |
305 string16 url_title; | 305 base::string16 url_title; |
306 data.GetURLAndTitle(&url, &url_title); | 306 data.GetURLAndTitle(&url, &url_title); |
307 if (url.is_valid()) { | 307 if (url.is_valid()) { |
308 drop_data->url = url; | 308 drop_data->url = url; |
309 drop_data->url_title = url_title; | 309 drop_data->url_title = url_title; |
310 } | 310 } |
311 | 311 |
312 string16 html; | 312 base::string16 html; |
313 GURL html_base_url; | 313 GURL html_base_url; |
314 data.GetHtml(&html, &html_base_url); | 314 data.GetHtml(&html, &html_base_url); |
315 if (!html.empty()) | 315 if (!html.empty()) |
316 drop_data->html = base::NullableString16(html, false); | 316 drop_data->html = base::NullableString16(html, false); |
317 if (html_base_url.is_valid()) | 317 if (html_base_url.is_valid()) |
318 drop_data->html_base_url = html_base_url; | 318 drop_data->html_base_url = html_base_url; |
319 | 319 |
320 std::vector<ui::OSExchangeData::FileInfo> files; | 320 std::vector<ui::OSExchangeData::FileInfo> files; |
321 if (data.GetFilenames(&files) && !files.empty()) { | 321 if (data.GetFilenames(&files) && !files.empty()) { |
322 for (std::vector<ui::OSExchangeData::FileInfo>::const_iterator | 322 for (std::vector<ui::OSExchangeData::FileInfo>::const_iterator |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 | 1291 |
1292 AttachTouchEditableToRenderView(); | 1292 AttachTouchEditableToRenderView(); |
1293 return view; | 1293 return view; |
1294 } | 1294 } |
1295 | 1295 |
1296 RenderWidgetHostView* WebContentsViewAura::CreateViewForPopupWidget( | 1296 RenderWidgetHostView* WebContentsViewAura::CreateViewForPopupWidget( |
1297 RenderWidgetHost* render_widget_host) { | 1297 RenderWidgetHost* render_widget_host) { |
1298 return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); | 1298 return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); |
1299 } | 1299 } |
1300 | 1300 |
1301 void WebContentsViewAura::SetPageTitle(const string16& title) { | 1301 void WebContentsViewAura::SetPageTitle(const base::string16& title) { |
1302 window_->set_title(title); | 1302 window_->set_title(title); |
1303 } | 1303 } |
1304 | 1304 |
1305 void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) { | 1305 void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) { |
1306 } | 1306 } |
1307 | 1307 |
1308 void WebContentsViewAura::RenderViewSwappedIn(RenderViewHost* host) { | 1308 void WebContentsViewAura::RenderViewSwappedIn(RenderViewHost* host) { |
1309 if (navigation_overlay_.get() && navigation_overlay_->has_window()) { | 1309 if (navigation_overlay_.get() && navigation_overlay_->has_window()) { |
1310 navigation_overlay_->StartObservingView( | 1310 navigation_overlay_->StartObservingView( |
1311 ToRenderWidgetHostViewAura(host->GetView())); | 1311 ToRenderWidgetHostViewAura(host->GetView())); |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 event.location(), | 1721 event.location(), |
1722 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1722 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1723 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1723 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1724 if (drag_dest_delegate_) | 1724 if (drag_dest_delegate_) |
1725 drag_dest_delegate_->OnDrop(); | 1725 drag_dest_delegate_->OnDrop(); |
1726 current_drop_data_.reset(); | 1726 current_drop_data_.reset(); |
1727 return current_drag_op_; | 1727 return current_drag_op_; |
1728 } | 1728 } |
1729 | 1729 |
1730 } // namespace content | 1730 } // namespace content |
OLD | NEW |