| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 using webkit_glue::AutofillForm; | 99 using webkit_glue::AutofillForm; |
| 100 using webkit_glue::PasswordForm; | 100 using webkit_glue::PasswordForm; |
| 101 using webkit_glue::PasswordFormDomManager; | 101 using webkit_glue::PasswordFormDomManager; |
| 102 using webkit_glue::SearchableFormData; | 102 using webkit_glue::SearchableFormData; |
| 103 using WebKit::WebConsoleMessage; | 103 using WebKit::WebConsoleMessage; |
| 104 using WebKit::WebData; | 104 using WebKit::WebData; |
| 105 using WebKit::WebDataSource; | 105 using WebKit::WebDataSource; |
| 106 using WebKit::WebDragData; | 106 using WebKit::WebDragData; |
| 107 using WebKit::WebForm; | 107 using WebKit::WebForm; |
| 108 using WebKit::WebHistoryItem; | 108 using WebKit::WebHistoryItem; |
| 109 using WebKit::WebNavigationPolicy; |
| 109 using WebKit::WebNavigationType; | 110 using WebKit::WebNavigationType; |
| 110 using WebKit::WebPopupMenuInfo; | 111 using WebKit::WebPopupMenuInfo; |
| 111 using WebKit::WebRect; | 112 using WebKit::WebRect; |
| 112 using WebKit::WebScriptSource; | 113 using WebKit::WebScriptSource; |
| 113 using WebKit::WebSize; | 114 using WebKit::WebSize; |
| 114 using WebKit::WebString; | 115 using WebKit::WebString; |
| 115 using WebKit::WebURL; | 116 using WebKit::WebURL; |
| 116 using WebKit::WebURLError; | 117 using WebKit::WebURLError; |
| 117 using WebKit::WebURLRequest; | 118 using WebKit::WebURLRequest; |
| 118 using WebKit::WebURLResponse; | 119 using WebKit::WebURLResponse; |
| 120 using WebKit::WebVector; |
| 121 using WebKit::WebWidget; |
| 119 using WebKit::WebWorker; | 122 using WebKit::WebWorker; |
| 120 using WebKit::WebWorkerClient; | 123 using WebKit::WebWorkerClient; |
| 121 using WebKit::WebVector; | |
| 122 | 124 |
| 123 //----------------------------------------------------------------------------- | 125 //----------------------------------------------------------------------------- |
| 124 | 126 |
| 125 // define to write the time necessary for thumbnail/DOM text retrieval, | 127 // define to write the time necessary for thumbnail/DOM text retrieval, |
| 126 // respectively, into the system debug log | 128 // respectively, into the system debug log |
| 127 // #define TIME_BITMAP_RETRIEVAL | 129 // #define TIME_BITMAP_RETRIEVAL |
| 128 // #define TIME_TEXT_RETRIEVAL | 130 // #define TIME_TEXT_RETRIEVAL |
| 129 | 131 |
| 130 // maximum number of characters in the document to index, any text beyond this | 132 // maximum number of characters in the document to index, any text beyond this |
| 131 // point will be clipped | 133 // point will be clipped |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 555 |
| 554 bool RenderView::CaptureThumbnail(WebView* view, | 556 bool RenderView::CaptureThumbnail(WebView* view, |
| 555 int w, | 557 int w, |
| 556 int h, | 558 int h, |
| 557 SkBitmap* thumbnail, | 559 SkBitmap* thumbnail, |
| 558 ThumbnailScore* score) { | 560 ThumbnailScore* score) { |
| 559 #ifdef TIME_BITMAP_RETRIEVAL | 561 #ifdef TIME_BITMAP_RETRIEVAL |
| 560 double begin = time_util::GetHighResolutionTimeNow(); | 562 double begin = time_util::GetHighResolutionTimeNow(); |
| 561 #endif | 563 #endif |
| 562 | 564 |
| 563 view->Layout(); | 565 view->layout(); |
| 564 const WebSize& size = view->GetSize(); | 566 const WebSize& size = view->size(); |
| 565 | 567 |
| 566 skia::PlatformCanvas canvas; | 568 skia::PlatformCanvas canvas; |
| 567 if (!canvas.initialize(size.width, size.height, true)) | 569 if (!canvas.initialize(size.width, size.height, true)) |
| 568 return false; | 570 return false; |
| 569 view->Paint(&canvas, WebRect(0, 0, size.width, size.height)); | 571 view->paint(&canvas, WebRect(0, 0, size.width, size.height)); |
| 570 | 572 |
| 571 skia::BitmapPlatformDevice& device = | 573 skia::BitmapPlatformDevice& device = |
| 572 static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); | 574 static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); |
| 573 | 575 |
| 574 const SkBitmap& src_bmp = device.accessBitmap(false); | 576 const SkBitmap& src_bmp = device.accessBitmap(false); |
| 575 | 577 |
| 576 SkRect dest_rect; | 578 SkRect dest_rect; |
| 577 dest_rect.set(0, 0, SkIntToScalar(w), SkIntToScalar(h)); | 579 dest_rect.set(0, 0, SkIntToScalar(w), SkIntToScalar(h)); |
| 578 float dest_aspect = dest_rect.width() / dest_rect.height(); | 580 float dest_aspect = dest_rect.width() / dest_rect.height(); |
| 579 | 581 |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 } | 1469 } |
| 1468 | 1470 |
| 1469 void RenderView::DidDestroyScriptContextForFrame(WebFrame* webframe) { | 1471 void RenderView::DidDestroyScriptContextForFrame(WebFrame* webframe) { |
| 1470 EventBindings::HandleContextDestroyed(webframe); | 1472 EventBindings::HandleContextDestroyed(webframe); |
| 1471 } | 1473 } |
| 1472 | 1474 |
| 1473 void RenderView::DidCreateIsolatedScriptContext(WebFrame* webframe) { | 1475 void RenderView::DidCreateIsolatedScriptContext(WebFrame* webframe) { |
| 1474 EventBindings::HandleContextCreated(webframe); | 1476 EventBindings::HandleContextCreated(webframe); |
| 1475 } | 1477 } |
| 1476 | 1478 |
| 1477 WindowOpenDisposition RenderView::DispositionForNavigationAction( | 1479 WebNavigationPolicy RenderView::PolicyForNavigationAction( |
| 1478 WebView* webview, | 1480 WebView* webview, |
| 1479 WebFrame* frame, | 1481 WebFrame* frame, |
| 1480 const WebURLRequest& request, | 1482 const WebURLRequest& request, |
| 1481 WebNavigationType type, | 1483 WebNavigationType type, |
| 1482 WindowOpenDisposition disposition, | 1484 WebNavigationPolicy default_policy, |
| 1483 bool is_redirect) { | 1485 bool is_redirect) { |
| 1484 // A content initiated navigation may have originated from a link-click, | 1486 // A content initiated navigation may have originated from a link-click, |
| 1485 // script, drag-n-drop operation, etc. | 1487 // script, drag-n-drop operation, etc. |
| 1486 bool is_content_initiated = | 1488 bool is_content_initiated = |
| 1487 NavigationState::FromDataSource(frame->GetProvisionalDataSource())-> | 1489 NavigationState::FromDataSource(frame->GetProvisionalDataSource())-> |
| 1488 is_content_initiated(); | 1490 is_content_initiated(); |
| 1489 | 1491 |
| 1490 // Webkit is asking whether to navigate to a new URL. | 1492 // Webkit is asking whether to navigate to a new URL. |
| 1491 // This is fine normally, except if we're showing UI from one security | 1493 // This is fine normally, except if we're showing UI from one security |
| 1492 // context and they're trying to navigate to a different context. | 1494 // context and they're trying to navigate to a different context. |
| 1493 const GURL& url = request.url(); | 1495 const GURL& url = request.url(); |
| 1494 | 1496 |
| 1495 // We only care about navigations that are within the current tab (as opposed | 1497 // We only care about navigations that are within the current tab (as opposed |
| 1496 // to, for example, opening a new window). | 1498 // to, for example, opening a new window). |
| 1497 // But we sometimes navigate to about:blank to clear a tab, and we want to | 1499 // But we sometimes navigate to about:blank to clear a tab, and we want to |
| 1498 // still allow that. | 1500 // still allow that. |
| 1499 if (disposition == CURRENT_TAB && is_content_initiated && | 1501 if (default_policy == WebKit::WebNavigationPolicyCurrentTab && |
| 1500 frame->GetParent() == NULL && !url.SchemeIs(chrome::kAboutScheme)) { | 1502 is_content_initiated && frame->GetParent() == NULL && |
| 1503 !url.SchemeIs(chrome::kAboutScheme)) { |
| 1501 // When we received such unsolicited navigations, we sometimes want to | 1504 // When we received such unsolicited navigations, we sometimes want to |
| 1502 // punt them up to the browser to handle. | 1505 // punt them up to the browser to handle. |
| 1503 if (BindingsPolicy::is_dom_ui_enabled(enabled_bindings_) || | 1506 if (BindingsPolicy::is_dom_ui_enabled(enabled_bindings_) || |
| 1504 BindingsPolicy::is_extension_enabled(enabled_bindings_) || | 1507 BindingsPolicy::is_extension_enabled(enabled_bindings_) || |
| 1505 frame->GetInViewSourceMode() || | 1508 frame->GetInViewSourceMode() || |
| 1506 url.SchemeIs(chrome::kViewSourceScheme) || | 1509 url.SchemeIs(chrome::kViewSourceScheme) || |
| 1507 url.SchemeIs(chrome::kPrintScheme)) { | 1510 url.SchemeIs(chrome::kPrintScheme)) { |
| 1508 OpenURL(webview, url, GURL(), disposition); | 1511 OpenURL(webview, url, GURL(), default_policy); |
| 1509 return IGNORE_ACTION; // Suppress the load here. | 1512 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
| 1510 } | 1513 } |
| 1511 } | 1514 } |
| 1512 | 1515 |
| 1513 // Detect when a page is "forking" a new tab that can be safely rendered in | 1516 // Detect when a page is "forking" a new tab that can be safely rendered in |
| 1514 // its own process. This is done by sites like Gmail that try to open links | 1517 // its own process. This is done by sites like Gmail that try to open links |
| 1515 // in new windows without script connections back to the original page. We | 1518 // in new windows without script connections back to the original page. We |
| 1516 // treat such cases as browser navigations (in which we will create a new | 1519 // treat such cases as browser navigations (in which we will create a new |
| 1517 // renderer for a cross-site navigation), rather than WebKit navigations. | 1520 // renderer for a cross-site navigation), rather than WebKit navigations. |
| 1518 // | 1521 // |
| 1519 // We use the following heuristic to decide whether to fork a new page in its | 1522 // We use the following heuristic to decide whether to fork a new page in its |
| 1520 // own process: | 1523 // own process: |
| 1521 // The parent page must open a new tab to about:blank, set the new tab's | 1524 // The parent page must open a new tab to about:blank, set the new tab's |
| 1522 // window.opener to null, and then redirect the tab to a cross-site URL using | 1525 // window.opener to null, and then redirect the tab to a cross-site URL using |
| 1523 // JavaScript. | 1526 // JavaScript. |
| 1524 bool is_fork = | 1527 bool is_fork = |
| 1525 // Must start from a tab showing about:blank, which is later redirected. | 1528 // Must start from a tab showing about:blank, which is later redirected. |
| 1526 frame->GetURL() == GURL("about:blank") && | 1529 frame->GetURL() == GURL("about:blank") && |
| 1527 // Must be the first real navigation of the tab. | 1530 // Must be the first real navigation of the tab. |
| 1528 GetHistoryBackListCount() < 1 && | 1531 GetHistoryBackListCount() < 1 && |
| 1529 GetHistoryForwardListCount() < 1 && | 1532 GetHistoryForwardListCount() < 1 && |
| 1530 // The parent page must have set the child's window.opener to null before | 1533 // The parent page must have set the child's window.opener to null before |
| 1531 // redirecting to the desired URL. | 1534 // redirecting to the desired URL. |
| 1532 frame->GetOpener() == NULL && | 1535 frame->GetOpener() == NULL && |
| 1533 // Must be a top-level frame. | 1536 // Must be a top-level frame. |
| 1534 frame->GetParent() == NULL && | 1537 frame->GetParent() == NULL && |
| 1535 // Must not have issued the request from this page. | 1538 // Must not have issued the request from this page. |
| 1536 is_content_initiated && | 1539 is_content_initiated && |
| 1537 // Must be targeted at the current tab. | 1540 // Must be targeted at the current tab. |
| 1538 disposition == CURRENT_TAB && | 1541 default_policy == WebKit::WebNavigationPolicyCurrentTab && |
| 1539 // Must be a JavaScript navigation, which appears as "other". | 1542 // Must be a JavaScript navigation, which appears as "other". |
| 1540 type == WebKit::WebNavigationTypeOther; | 1543 type == WebKit::WebNavigationTypeOther; |
| 1541 if (is_fork) { | 1544 if (is_fork) { |
| 1542 // Open the URL via the browser, not via WebKit. | 1545 // Open the URL via the browser, not via WebKit. |
| 1543 OpenURL(webview, url, GURL(), disposition); | 1546 OpenURL(webview, url, GURL(), default_policy); |
| 1544 return IGNORE_ACTION; | 1547 return WebKit::WebNavigationPolicyIgnore; |
| 1545 } | 1548 } |
| 1546 | 1549 |
| 1547 return disposition; | 1550 return default_policy; |
| 1548 } | 1551 } |
| 1549 | 1552 |
| 1550 void RenderView::RunJavaScriptAlert(WebFrame* webframe, | 1553 void RenderView::RunJavaScriptAlert(WebFrame* webframe, |
| 1551 const std::wstring& message) { | 1554 const std::wstring& message) { |
| 1552 RunJavaScriptMessage(MessageBoxFlags::kIsJavascriptAlert, | 1555 RunJavaScriptMessage(MessageBoxFlags::kIsJavascriptAlert, |
| 1553 message, | 1556 message, |
| 1554 std::wstring(), | 1557 std::wstring(), |
| 1555 webframe->GetURL(), | 1558 webframe->GetURL(), |
| 1556 NULL); | 1559 NULL); |
| 1557 } | 1560 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1877 NOTIMPLEMENTED(); | 1880 NOTIMPLEMENTED(); |
| 1878 #endif | 1881 #endif |
| 1879 } | 1882 } |
| 1880 | 1883 |
| 1881 WebWorker* RenderView::CreateWebWorker(WebWorkerClient* client) { | 1884 WebWorker* RenderView::CreateWebWorker(WebWorkerClient* client) { |
| 1882 return new WebWorkerProxy(client, RenderThread::current(), routing_id_); | 1885 return new WebWorkerProxy(client, RenderThread::current(), routing_id_); |
| 1883 } | 1886 } |
| 1884 | 1887 |
| 1885 void RenderView::OpenURL(WebView* webview, const GURL& url, | 1888 void RenderView::OpenURL(WebView* webview, const GURL& url, |
| 1886 const GURL& referrer, | 1889 const GURL& referrer, |
| 1887 WindowOpenDisposition disposition) { | 1890 WebNavigationPolicy policy) { |
| 1888 Send(new ViewHostMsg_OpenURL(routing_id_, url, referrer, disposition)); | 1891 Send(new ViewHostMsg_OpenURL( |
| 1892 routing_id_, url, referrer, NavigationPolicyToDisposition(policy))); |
| 1889 } | 1893 } |
| 1890 | 1894 |
| 1891 void RenderView::DidContentsSizeChange(WebWidget* webwidget, | 1895 void RenderView::DidContentsSizeChange(WebWidget* webwidget, |
| 1892 int new_width, | 1896 int new_width, |
| 1893 int new_height) { | 1897 int new_height) { |
| 1894 // We don't always want to send the change messages over IPC, only if we've | 1898 // We don't always want to send the change messages over IPC, only if we've |
| 1895 // be put in that mode by getting a |ViewMsg_EnableIntrinsicWidthChangedMode| | 1899 // be put in that mode by getting a |ViewMsg_EnableIntrinsicWidthChangedMode| |
| 1896 // message. | 1900 // message. |
| 1897 // TODO(rafaelw): Figure out where the best place to set this for extensions | 1901 // TODO(rafaelw): Figure out where the best place to set this for extensions |
| 1898 // is. It isn't clean to test for ExtensionView by examining the | 1902 // is. It isn't clean to test for ExtensionView by examining the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1911 } | 1915 } |
| 1912 } | 1916 } |
| 1913 | 1917 |
| 1914 // We are supposed to get a single call to Show for a newly created RenderView | 1918 // We are supposed to get a single call to Show for a newly created RenderView |
| 1915 // that was created via RenderView::CreateWebView. So, we wait until this | 1919 // that was created via RenderView::CreateWebView. So, we wait until this |
| 1916 // point to dispatch the ShowView message. | 1920 // point to dispatch the ShowView message. |
| 1917 // | 1921 // |
| 1918 // This method provides us with the information about how to display the newly | 1922 // This method provides us with the information about how to display the newly |
| 1919 // created RenderView (i.e., as a constrained popup or as a new tab). | 1923 // created RenderView (i.e., as a constrained popup or as a new tab). |
| 1920 // | 1924 // |
| 1921 void RenderView::Show(WebWidget* webwidget, WindowOpenDisposition disposition) { | 1925 void RenderView::show(WebNavigationPolicy policy) { |
| 1922 DCHECK(!did_show_) << "received extraneous Show call"; | 1926 DCHECK(!did_show_) << "received extraneous Show call"; |
| 1923 DCHECK(opener_id_ != MSG_ROUTING_NONE); | 1927 DCHECK(opener_id_ != MSG_ROUTING_NONE); |
| 1924 | 1928 |
| 1925 if (did_show_) | 1929 if (did_show_) |
| 1926 return; | 1930 return; |
| 1927 did_show_ = true; | 1931 did_show_ = true; |
| 1928 | 1932 |
| 1929 // NOTE: initial_pos_ may still have its default values at this point, but | 1933 // NOTE: initial_pos_ may still have its default values at this point, but |
| 1930 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the | 1934 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the |
| 1931 // browser process will impose a default position otherwise. | 1935 // browser process will impose a default position otherwise. |
| 1932 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, disposition, | 1936 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, |
| 1933 initial_pos_, opened_by_user_gesture_, creator_url_)); | 1937 NavigationPolicyToDisposition(policy), initial_pos_, |
| 1938 opened_by_user_gesture_, creator_url_)); |
| 1934 SetPendingWindowRect(initial_pos_); | 1939 SetPendingWindowRect(initial_pos_); |
| 1935 } | 1940 } |
| 1936 | 1941 |
| 1937 void RenderView::CloseWidgetSoon(WebWidget* webwidget) { | 1942 void RenderView::closeWidgetSoon() { |
| 1938 if (!popup_notification_visible_) | 1943 if (!popup_notification_visible_) |
| 1939 RenderWidget::CloseWidgetSoon(webwidget); | 1944 RenderWidget::closeWidgetSoon(); |
| 1940 } | 1945 } |
| 1941 | 1946 |
| 1942 void RenderView::RunModal(WebWidget* webwidget) { | 1947 void RenderView::runModal() { |
| 1943 DCHECK(did_show_) << "should already have shown the view"; | 1948 DCHECK(did_show_) << "should already have shown the view"; |
| 1944 | 1949 |
| 1945 IPC::SyncMessage* msg = new ViewHostMsg_RunModal(routing_id_); | 1950 IPC::SyncMessage* msg = new ViewHostMsg_RunModal(routing_id_); |
| 1946 | 1951 |
| 1947 msg->set_pump_messages_event(modal_dialog_event_.get()); | 1952 msg->set_pump_messages_event(modal_dialog_event_.get()); |
| 1948 Send(msg); | 1953 Send(msg); |
| 1949 } | 1954 } |
| 1950 | 1955 |
| 1951 void RenderView::SyncNavigationState() { | 1956 void RenderView::SyncNavigationState() { |
| 1952 if (!webview()) | 1957 if (!webview()) |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2725 | 2730 |
| 2726 Send(new ViewHostMsg_ClosePage_ACK(routing_id_, | 2731 Send(new ViewHostMsg_ClosePage_ACK(routing_id_, |
| 2727 new_render_process_host_id, | 2732 new_render_process_host_id, |
| 2728 new_request_id)); | 2733 new_request_id)); |
| 2729 } | 2734 } |
| 2730 | 2735 |
| 2731 void RenderView::OnThemeChanged() { | 2736 void RenderView::OnThemeChanged() { |
| 2732 #if defined(OS_WIN) | 2737 #if defined(OS_WIN) |
| 2733 gfx::NativeTheme::instance()->CloseHandles(); | 2738 gfx::NativeTheme::instance()->CloseHandles(); |
| 2734 gfx::Rect view_rect(0, 0, size_.width(), size_.height()); | 2739 gfx::Rect view_rect(0, 0, size_.width(), size_.height()); |
| 2735 DidInvalidateRect(webwidget_, view_rect); | 2740 didInvalidateRect(view_rect); |
| 2736 #else // defined(OS_WIN) | 2741 #else // defined(OS_WIN) |
| 2737 // TODO(port): we don't support theming on non-Windows platforms yet | 2742 // TODO(port): we don't support theming on non-Windows platforms yet |
| 2738 NOTIMPLEMENTED(); | 2743 NOTIMPLEMENTED(); |
| 2739 #endif | 2744 #endif |
| 2740 } | 2745 } |
| 2741 | 2746 |
| 2742 void RenderView::DidAddHistoryItem() { | 2747 void RenderView::DidAddHistoryItem() { |
| 2743 // We don't want to update the history length for the start page | 2748 // We don't want to update the history length for the start page |
| 2744 // navigation. | 2749 // navigation. |
| 2745 WebFrame* main_frame = webview()->GetMainFrame(); | 2750 WebFrame* main_frame = webview()->GetMainFrame(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3011 // occurred. | 3016 // occurred. |
| 3012 if (acc_obj_id >= 0) | 3017 if (acc_obj_id >= 0) |
| 3013 Send(new ViewHostMsg_AccessibilityFocusChange(routing_id_, acc_obj_id)); | 3018 Send(new ViewHostMsg_AccessibilityFocusChange(routing_id_, acc_obj_id)); |
| 3014 | 3019 |
| 3015 #else // defined(OS_WIN) | 3020 #else // defined(OS_WIN) |
| 3016 // TODO(port): accessibility not yet implemented | 3021 // TODO(port): accessibility not yet implemented |
| 3017 NOTIMPLEMENTED(); | 3022 NOTIMPLEMENTED(); |
| 3018 #endif | 3023 #endif |
| 3019 } | 3024 } |
| 3020 | 3025 |
| 3026 void RenderView::DidMovePlugin(const WebPluginGeometry& move) { |
| 3027 SchedulePluginMove(move); |
| 3028 } |
| 3029 |
| 3021 void RenderView::SendPasswordForms(WebFrame* frame) { | 3030 void RenderView::SendPasswordForms(WebFrame* frame) { |
| 3022 std::vector<WebForm> forms; | 3031 std::vector<WebForm> forms; |
| 3023 frame->GetForms(&forms); | 3032 frame->GetForms(&forms); |
| 3024 | 3033 |
| 3025 std::vector<PasswordForm> password_forms; | 3034 std::vector<PasswordForm> password_forms; |
| 3026 for (size_t i = 0; i < forms.size(); ++i) { | 3035 for (size_t i = 0; i < forms.size(); ++i) { |
| 3027 const WebForm& form = forms[i]; | 3036 const WebForm& form = forms[i]; |
| 3028 | 3037 |
| 3029 // Respect autocomplete=off. | 3038 // Respect autocomplete=off. |
| 3030 if (form.isAutoCompleteEnabled()) { | 3039 if (form.isAutoCompleteEnabled()) { |
| 3031 scoped_ptr<PasswordForm> password_form( | 3040 scoped_ptr<PasswordForm> password_form( |
| 3032 PasswordFormDomManager::CreatePasswordForm(form)); | 3041 PasswordFormDomManager::CreatePasswordForm(form)); |
| 3033 if (password_form.get()) | 3042 if (password_form.get()) |
| 3034 password_forms.push_back(*password_form); | 3043 password_forms.push_back(*password_form); |
| 3035 } | 3044 } |
| 3036 } | 3045 } |
| 3037 | 3046 |
| 3038 if (!password_forms.empty()) | 3047 if (!password_forms.empty()) |
| 3039 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); | 3048 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); |
| 3040 } | 3049 } |
| 3041 | 3050 |
| 3042 void RenderView::Print(WebFrame* frame, bool script_initiated) { | 3051 void RenderView::Print(WebFrame* frame, bool script_initiated) { |
| 3043 DCHECK(frame); | 3052 DCHECK(frame); |
| 3044 if (print_helper_.get() == NULL) { | 3053 if (print_helper_.get() == NULL) { |
| 3045 print_helper_.reset(new PrintWebViewHelper(this)); | 3054 print_helper_.reset(new PrintWebViewHelper(this)); |
| 3046 } | 3055 } |
| 3047 print_helper_->Print(frame, script_initiated); | 3056 print_helper_->Print(frame, script_initiated); |
| 3048 } | 3057 } |
| OLD | NEW |