| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 #include "skia/ext/platform_canvas.h" | 137 #include "skia/ext/platform_canvas.h" |
| 138 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | 138 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" |
| 139 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" | 139 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" |
| 140 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" | 140 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" |
| 141 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 141 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
| 142 #include "webkit/glue/dom_operations.h" | 142 #include "webkit/glue/dom_operations.h" |
| 143 #include "webkit/glue/dom_operations_private.h" | 143 #include "webkit/glue/dom_operations_private.h" |
| 144 #include "webkit/glue/feed.h" | 144 #include "webkit/glue/feed.h" |
| 145 #include "webkit/glue/glue_serialize.h" | 145 #include "webkit/glue/glue_serialize.h" |
| 146 #include "webkit/glue/glue_util.h" | 146 #include "webkit/glue/glue_util.h" |
| 147 #include "webkit/glue/webappcachecontext.h" |
| 147 #include "webkit/glue/webdatasource_impl.h" | 148 #include "webkit/glue/webdatasource_impl.h" |
| 148 #include "webkit/glue/weberror_impl.h" | 149 #include "webkit/glue/weberror_impl.h" |
| 149 #include "webkit/glue/webframe_impl.h" | 150 #include "webkit/glue/webframe_impl.h" |
| 150 #include "webkit/glue/webhistoryitem_impl.h" | 151 #include "webkit/glue/webhistoryitem_impl.h" |
| 151 #include "webkit/glue/weburlrequest_impl.h" | 152 #include "webkit/glue/weburlrequest_impl.h" |
| 152 #include "webkit/glue/webtextinput_impl.h" | 153 #include "webkit/glue/webtextinput_impl.h" |
| 153 #include "webkit/glue/webview_impl.h" | 154 #include "webkit/glue/webview_impl.h" |
| 154 | 155 |
| 155 #if defined(OS_LINUX) | 156 #if defined(OS_LINUX) |
| 156 #include <gdk/gdk.h> | 157 #include <gdk/gdk.h> |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 currently_loading_request_(NULL), | 349 currently_loading_request_(NULL), |
| 349 plugin_delegate_(NULL), | 350 plugin_delegate_(NULL), |
| 350 active_match_frame_(NULL), | 351 active_match_frame_(NULL), |
| 351 active_match_index_(-1), | 352 active_match_index_(-1), |
| 352 locating_active_rect_(false), | 353 locating_active_rect_(false), |
| 353 resume_scoping_from_range_(NULL), | 354 resume_scoping_from_range_(NULL), |
| 354 last_match_count_(-1), | 355 last_match_count_(-1), |
| 355 total_matchcount_(-1), | 356 total_matchcount_(-1), |
| 356 frames_scoping_count_(-1), | 357 frames_scoping_count_(-1), |
| 357 scoping_complete_(false), | 358 scoping_complete_(false), |
| 358 next_invalidate_after_(0) { | 359 next_invalidate_after_(0), |
| 360 app_cache_context_(WebAppCacheContext::Create()) { |
| 359 StatsCounter(kWebFrameActiveCount).Increment(); | 361 StatsCounter(kWebFrameActiveCount).Increment(); |
| 360 live_object_count_++; | 362 live_object_count_++; |
| 361 } | 363 } |
| 362 | 364 |
| 363 WebFrameImpl::~WebFrameImpl() { | 365 WebFrameImpl::~WebFrameImpl() { |
| 364 StatsCounter(kWebFrameActiveCount).Decrement(); | 366 StatsCounter(kWebFrameActiveCount).Decrement(); |
| 365 live_object_count_--; | 367 live_object_count_--; |
| 366 | 368 |
| 367 CancelPendingScopingEffort(); | 369 CancelPendingScopingEffort(); |
| 368 ClearPasswordListeners(); | 370 ClearPasswordListeners(); |
| 369 } | 371 } |
| 370 | 372 |
| 371 // WebFrame ------------------------------------------------------------------- | 373 // WebFrame ------------------------------------------------------------------- |
| 372 | 374 |
| 373 void WebFrameImpl::InitMainFrame(WebViewImpl* webview_impl) { | 375 void WebFrameImpl::InitMainFrame(WebViewImpl* webview_impl) { |
| 374 webview_impl_ = webview_impl; | 376 webview_impl_ = webview_impl; |
| 375 | 377 |
| 376 RefPtr<Frame> frame = | 378 RefPtr<Frame> frame = |
| 377 Frame::create(webview_impl_->page(), 0, &frame_loader_client_); | 379 Frame::create(webview_impl_->page(), 0, &frame_loader_client_); |
| 378 frame_ = frame.get(); | 380 frame_ = frame.get(); |
| 379 | 381 |
| 380 // Add reference on behalf of FrameLoader. See comments in | 382 // Add reference on behalf of FrameLoader. See comments in |
| 381 // WebFrameLoaderClient::frameLoaderDestroyed for more info. | 383 // WebFrameLoaderClient::frameLoaderDestroyed for more info. |
| 382 AddRef(); | 384 AddRef(); |
| 383 | 385 |
| 384 // We must call init() after frame_ is assigned because it is referenced | 386 // We must call init() after frame_ is assigned because it is referenced |
| 385 // during init(). | 387 // during init(). |
| 386 frame_->init(); | 388 frame_->init(); |
| 389 |
| 390 // Inform the browser process of this top-level frame |
| 391 app_cache_context_->Initialize(WebAppCacheContext::MAIN_FRAME, NULL); |
| 387 } | 392 } |
| 388 | 393 |
| 389 void WebFrameImpl::LoadRequest(WebRequest* request) { | 394 void WebFrameImpl::LoadRequest(WebRequest* request) { |
| 390 SubstituteData data; | 395 SubstituteData data; |
| 391 InternalLoadRequest(request, data, false); | 396 InternalLoadRequest(request, data, false); |
| 392 } | 397 } |
| 393 | 398 |
| 394 void WebFrameImpl::InternalLoadRequest(const WebRequest* request, | 399 void WebFrameImpl::InternalLoadRequest(const WebRequest* request, |
| 395 const SubstituteData& data, | 400 const SubstituteData& data, |
| 396 bool replace) { | 401 bool replace) { |
| (...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 // so that webframe->frame_ is in the tree before triggering | 1804 // so that webframe->frame_ is in the tree before triggering |
| 1800 // onload event handler. | 1805 // onload event handler. |
| 1801 // Because the event handler may set webframe->frame_ to null, | 1806 // Because the event handler may set webframe->frame_ to null, |
| 1802 // it is necessary to check the value after calling init() and | 1807 // it is necessary to check the value after calling init() and |
| 1803 // return without loading URL. | 1808 // return without loading URL. |
| 1804 // (b:791612) | 1809 // (b:791612) |
| 1805 child_frame->init(); // create an empty document | 1810 child_frame->init(); // create an empty document |
| 1806 if (!child_frame->tree()->parent()) | 1811 if (!child_frame->tree()->parent()) |
| 1807 return NULL; | 1812 return NULL; |
| 1808 | 1813 |
| 1814 // Inform the browser process of this child frame |
| 1815 webframe->app_cache_context_->Initialize(WebAppCacheContext::CHILD_FRAME, |
| 1816 app_cache_context_.get()); |
| 1817 |
| 1809 frame_->loader()->loadURLIntoChildFrame( | 1818 frame_->loader()->loadURLIntoChildFrame( |
| 1810 request.resourceRequest().url(), | 1819 request.resourceRequest().url(), |
| 1811 request.resourceRequest().httpReferrer(), | 1820 request.resourceRequest().httpReferrer(), |
| 1812 child_frame.get()); | 1821 child_frame.get()); |
| 1822 |
| 1813 // A synchronous navigation (about:blank) would have already processed | 1823 // A synchronous navigation (about:blank) would have already processed |
| 1814 // onload, so it is possible for the frame to have already been destroyed by | 1824 // onload, so it is possible for the frame to have already been destroyed by |
| 1815 // script in the page. | 1825 // script in the page. |
| 1816 if (!child_frame->tree()->parent()) | 1826 if (!child_frame->tree()->parent()) |
| 1817 return NULL; | 1827 return NULL; |
| 1818 | 1828 |
| 1819 return child_frame.release(); | 1829 return child_frame.release(); |
| 1820 } | 1830 } |
| 1821 | 1831 |
| 1822 bool WebFrameImpl::ExecuteCoreCommandByName(const std::string& name, | 1832 bool WebFrameImpl::ExecuteCoreCommandByName(const std::string& name, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 PlatformContextSkia context(canvas); | 1918 PlatformContextSkia context(canvas); |
| 1909 GraphicsContext spool(&context); | 1919 GraphicsContext spool(&context); |
| 1910 #elif defined(OS_MACOSX) | 1920 #elif defined(OS_MACOSX) |
| 1911 CGContextRef context = canvas->beginPlatformPaint(); | 1921 CGContextRef context = canvas->beginPlatformPaint(); |
| 1912 GraphicsContext spool(context); | 1922 GraphicsContext spool(context); |
| 1913 #endif | 1923 #endif |
| 1914 | 1924 |
| 1915 return print_context_->spoolPage(spool, page); | 1925 return print_context_->spoolPage(spool, page); |
| 1916 } | 1926 } |
| 1917 | 1927 |
| 1928 void WebFrameImpl::SelectAppCacheWithoutManifest() { |
| 1929 WebDataSource* ds = GetDataSource(); |
| 1930 DCHECK(ds); |
| 1931 if (ds->HasUnreachableURL()) { |
| 1932 app_cache_context_->SelectAppCacheWithoutManifest( |
| 1933 ds->GetUnreachableURL(), |
| 1934 WebAppCacheContext::kNoAppCacheId); |
| 1935 } else { |
| 1936 const WebResponse& response = ds->GetResponse(); |
| 1937 app_cache_context_->SelectAppCacheWithoutManifest( |
| 1938 GetURL(), |
| 1939 response.GetAppCacheID()); |
| 1940 } |
| 1941 } |
| 1942 |
| 1943 void WebFrameImpl::SelectAppCacheWithManifest(const GURL &manifest_url) { |
| 1944 WebDataSource* ds = GetDataSource(); |
| 1945 DCHECK(ds); |
| 1946 DCHECK(!ds->HasUnreachableURL()); |
| 1947 const WebResponse& response = ds->GetResponse(); |
| 1948 app_cache_context_->SelectAppCacheWithManifest( |
| 1949 GetURL(), |
| 1950 response.GetAppCacheID(), |
| 1951 manifest_url); |
| 1952 } |
| 1953 |
| 1918 void WebFrameImpl::EndPrint() { | 1954 void WebFrameImpl::EndPrint() { |
| 1919 DCHECK(print_context_.get()); | 1955 DCHECK(print_context_.get()); |
| 1920 if (print_context_.get()) | 1956 if (print_context_.get()) |
| 1921 print_context_->end(); | 1957 print_context_->end(); |
| 1922 print_context_.reset(NULL); | 1958 print_context_.reset(NULL); |
| 1923 } | 1959 } |
| 1924 | 1960 |
| 1925 int WebFrameImpl::PendingFrameUnloadEventCount() const { | 1961 int WebFrameImpl::PendingFrameUnloadEventCount() const { |
| 1926 return frame()->eventHandler()->pendingFrameUnloadEventCount(); | 1962 return frame()->eventHandler()->pendingFrameUnloadEventCount(); |
| 1927 } | 1963 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1939 return password_listeners_.get(input_element); | 1975 return password_listeners_.get(input_element); |
| 1940 } | 1976 } |
| 1941 | 1977 |
| 1942 void WebFrameImpl::ClearPasswordListeners() { | 1978 void WebFrameImpl::ClearPasswordListeners() { |
| 1943 for (PasswordListenerMap::iterator iter = password_listeners_.begin(); | 1979 for (PasswordListenerMap::iterator iter = password_listeners_.begin(); |
| 1944 iter != password_listeners_.end(); ++iter) { | 1980 iter != password_listeners_.end(); ++iter) { |
| 1945 delete iter->second; | 1981 delete iter->second; |
| 1946 } | 1982 } |
| 1947 password_listeners_.clear(); | 1983 password_listeners_.clear(); |
| 1948 } | 1984 } |
| OLD | NEW |