OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2007 Google Inc. All Rights Reserved. | 2 * Copyright 2007 Google Inc. All Rights Reserved. |
3 * | 3 * |
4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
5 * | 5 * |
6 * ***** BEGIN LICENSE BLOCK ***** | 6 * ***** BEGIN LICENSE BLOCK ***** |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 using WebKit::WebDragData; | 120 using WebKit::WebDragData; |
121 using WebKit::WebInputEvent; | 121 using WebKit::WebInputEvent; |
122 using WebKit::WebKeyboardEvent; | 122 using WebKit::WebKeyboardEvent; |
123 using WebKit::WebMouseEvent; | 123 using WebKit::WebMouseEvent; |
124 using WebKit::WebMouseWheelEvent; | 124 using WebKit::WebMouseWheelEvent; |
125 using WebKit::WebPoint; | 125 using WebKit::WebPoint; |
126 using WebKit::WebRect; | 126 using WebKit::WebRect; |
127 using WebKit::WebSize; | 127 using WebKit::WebSize; |
128 | 128 |
| 129 using webkit_glue::ImageResourceFetcher; |
| 130 |
129 // Change the text zoom level by kTextSizeMultiplierRatio each time the user | 131 // Change the text zoom level by kTextSizeMultiplierRatio each time the user |
130 // zooms text in or out (ie., change by 20%). The min and max values limit | 132 // zooms text in or out (ie., change by 20%). The min and max values limit |
131 // text zoom to half and 3x the original text size. These three values match | 133 // text zoom to half and 3x the original text size. These three values match |
132 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm | 134 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm |
133 static const double kTextSizeMultiplierRatio = 1.2; | 135 static const double kTextSizeMultiplierRatio = 1.2; |
134 static const double kMinTextSizeMultiplier = 0.5; | 136 static const double kMinTextSizeMultiplier = 0.5; |
135 static const double kMaxTextSizeMultiplier = 3.0; | 137 static const double kMaxTextSizeMultiplier = 3.0; |
136 | 138 |
137 // The webcore drag operation type when something is trying to be dropped on | 139 // The webcore drag operation type when something is trying to be dropped on |
138 // the webview. These values are taken from Apple's windows port. | 140 // the webview. These values are taken from Apple's windows port. |
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 } | 1412 } |
1411 | 1413 |
1412 // Releases references used to restore focus. | 1414 // Releases references used to restore focus. |
1413 void WebViewImpl::ReleaseFocusReferences() { | 1415 void WebViewImpl::ReleaseFocusReferences() { |
1414 if (last_focused_frame_.get()) { | 1416 if (last_focused_frame_.get()) { |
1415 last_focused_frame_.release(); | 1417 last_focused_frame_.release(); |
1416 last_focused_node_.release(); | 1418 last_focused_node_.release(); |
1417 } | 1419 } |
1418 } | 1420 } |
1419 | 1421 |
1420 bool WebViewImpl::DownloadImage(int id, const GURL& image_url, int image_size) { | 1422 bool WebViewImpl::DownloadImage(int id, const GURL& image_url, |
| 1423 int image_size) { |
1421 if (!page_.get()) | 1424 if (!page_.get()) |
1422 return false; | 1425 return false; |
1423 image_fetchers_.insert( | 1426 image_fetchers_.insert(new ImageResourceFetcher( |
1424 new ImageResourceFetcher(this, id, image_url, image_size)); | 1427 image_url, main_frame(), id, image_size, |
| 1428 NewCallback(this, &WebViewImpl::OnImageFetchComplete))); |
1425 return true; | 1429 return true; |
1426 } | 1430 } |
1427 | 1431 |
1428 void WebViewImpl::SetPreferences(const WebPreferences& preferences) { | 1432 void WebViewImpl::SetPreferences(const WebPreferences& preferences) { |
1429 if (!page_.get()) | 1433 if (!page_.get()) |
1430 return; | 1434 return; |
1431 | 1435 |
1432 // Keep a local copy of the preferences struct for GetPreferences. | 1436 // Keep a local copy of the preferences struct for GetPreferences. |
1433 webprefs_ = preferences; | 1437 webprefs_ = preferences; |
1434 | 1438 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 } | 1850 } |
1847 | 1851 |
1848 void WebViewImpl::StartDragging(const WebDragData& drag_data) { | 1852 void WebViewImpl::StartDragging(const WebDragData& drag_data) { |
1849 if (delegate_) { | 1853 if (delegate_) { |
1850 DCHECK(!doing_drag_and_drop_); | 1854 DCHECK(!doing_drag_and_drop_); |
1851 doing_drag_and_drop_ = true; | 1855 doing_drag_and_drop_ = true; |
1852 delegate_->StartDragging(this, drag_data); | 1856 delegate_->StartDragging(this, drag_data); |
1853 } | 1857 } |
1854 } | 1858 } |
1855 | 1859 |
1856 void WebViewImpl::ImageResourceDownloadDone(ImageResourceFetcher* fetcher, | 1860 void WebViewImpl::OnImageFetchComplete(ImageResourceFetcher* fetcher, |
1857 bool errored, | 1861 const SkBitmap& image) { |
1858 const SkBitmap& image) { | |
1859 if (delegate_) { | 1862 if (delegate_) { |
1860 delegate_->DidDownloadImage(fetcher->id(), fetcher->image_url(), errored, | 1863 delegate_->DidDownloadImage(fetcher->id(), fetcher->image_url(), |
1861 image); | 1864 image.isNull(), image); |
1862 } | 1865 } |
1863 DeleteImageResourceFetcher(fetcher); | 1866 DeleteImageResourceFetcher(fetcher); |
1864 } | 1867 } |
1865 | 1868 |
1866 void WebViewImpl::SetCurrentHistoryItem(WebCore::HistoryItem* item) { | 1869 void WebViewImpl::SetCurrentHistoryItem(WebCore::HistoryItem* item) { |
1867 back_forward_list_client_impl_.SetCurrentHistoryItem(item); | 1870 back_forward_list_client_impl_.SetCurrentHistoryItem(item); |
1868 } | 1871 } |
1869 | 1872 |
1870 WebCore::HistoryItem* WebViewImpl::GetPreviousHistoryItem() { | 1873 WebCore::HistoryItem* WebViewImpl::GetPreviousHistoryItem() { |
1871 return back_forward_list_client_impl_.GetPreviousHistoryItem(); | 1874 return back_forward_list_client_impl_.GetPreviousHistoryItem(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 | 1943 |
1941 return document->focusedNode(); | 1944 return document->focusedNode(); |
1942 } | 1945 } |
1943 | 1946 |
1944 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { | 1947 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { |
1945 IntPoint doc_point( | 1948 IntPoint doc_point( |
1946 page_->mainFrame()->view()->windowToContents(pos)); | 1949 page_->mainFrame()->view()->windowToContents(pos)); |
1947 return page_->mainFrame()->eventHandler()-> | 1950 return page_->mainFrame()->eventHandler()-> |
1948 hitTestResultAtPoint(doc_point, false); | 1951 hitTestResultAtPoint(doc_point, false); |
1949 } | 1952 } |
OLD | NEW |