| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/render_view.h" | 5 #include "content/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 WebFileChooserCompletion* c) | 319 WebFileChooserCompletion* c) |
| 320 : params(p), | 320 : params(p), |
| 321 completion(c) { | 321 completion(c) { |
| 322 } | 322 } |
| 323 ViewHostMsg_RunFileChooser_Params params; | 323 ViewHostMsg_RunFileChooser_Params params; |
| 324 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. | 324 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. |
| 325 }; | 325 }; |
| 326 | 326 |
| 327 RenderView::RenderView(RenderThreadBase* render_thread, | 327 RenderView::RenderView(RenderThreadBase* render_thread, |
| 328 gfx::NativeViewId parent_hwnd, | 328 gfx::NativeViewId parent_hwnd, |
| 329 gfx::PluginWindowHandle compositing_surface, | |
| 330 int32 opener_id, | 329 int32 opener_id, |
| 331 const RendererPreferences& renderer_prefs, | 330 const RendererPreferences& renderer_prefs, |
| 332 const WebPreferences& webkit_prefs, | 331 const WebPreferences& webkit_prefs, |
| 333 SharedRenderViewCounter* counter, | 332 SharedRenderViewCounter* counter, |
| 334 int32 routing_id, | 333 int32 routing_id, |
| 335 int64 session_storage_namespace_id, | 334 int64 session_storage_namespace_id, |
| 336 const string16& frame_name) | 335 const string16& frame_name) |
| 337 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), | 336 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), |
| 338 webkit_preferences_(webkit_prefs), | 337 webkit_preferences_(webkit_prefs), |
| 339 send_content_state_immediately_(false), | 338 send_content_state_immediately_(false), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 376 |
| 378 render_thread_->AddRoute(routing_id_, this); | 377 render_thread_->AddRoute(routing_id_, this); |
| 379 // Take a reference on behalf of the RenderThread. This will be balanced | 378 // Take a reference on behalf of the RenderThread. This will be balanced |
| 380 // when we receive ViewMsg_Close. | 379 // when we receive ViewMsg_Close. |
| 381 AddRef(); | 380 AddRef(); |
| 382 | 381 |
| 383 // If this is a popup, we must wait for the CreatingNew_ACK message before | 382 // If this is a popup, we must wait for the CreatingNew_ACK message before |
| 384 // completing initialization. Otherwise, we can finish it now. | 383 // completing initialization. Otherwise, we can finish it now. |
| 385 if (opener_id == MSG_ROUTING_NONE) { | 384 if (opener_id == MSG_ROUTING_NONE) { |
| 386 did_show_ = true; | 385 did_show_ = true; |
| 387 CompleteInit(parent_hwnd, compositing_surface); | 386 CompleteInit(parent_hwnd); |
| 388 } | 387 } |
| 389 | 388 |
| 390 g_view_map.Get().insert(std::make_pair(webview(), this)); | 389 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| 391 webkit_preferences_.Apply(webview()); | 390 webkit_preferences_.Apply(webview()); |
| 392 webview()->initializeMainFrame(this); | 391 webview()->initializeMainFrame(this); |
| 393 if (!frame_name.empty()) | 392 if (!frame_name.empty()) |
| 394 webview()->mainFrame()->setName(frame_name); | 393 webview()->mainFrame()->setName(frame_name); |
| 395 webview()->settings()->setMinimumTimerInterval( | 394 webview()->settings()->setMinimumTimerInterval( |
| 396 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : | 395 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : |
| 397 webkit_glue::kForegroundTabTimerInterval); | 396 webkit_glue::kForegroundTabTimerInterval); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 RenderView* RenderView::FromWebView(WebView* webview) { | 463 RenderView* RenderView::FromWebView(WebView* webview) { |
| 465 ViewMap* views = g_view_map.Pointer(); | 464 ViewMap* views = g_view_map.Pointer(); |
| 466 ViewMap::iterator it = views->find(webview); | 465 ViewMap::iterator it = views->find(webview); |
| 467 return it == views->end() ? NULL : it->second; | 466 return it == views->end() ? NULL : it->second; |
| 468 } | 467 } |
| 469 | 468 |
| 470 /*static*/ | 469 /*static*/ |
| 471 RenderView* RenderView::Create( | 470 RenderView* RenderView::Create( |
| 472 RenderThreadBase* render_thread, | 471 RenderThreadBase* render_thread, |
| 473 gfx::NativeViewId parent_hwnd, | 472 gfx::NativeViewId parent_hwnd, |
| 474 gfx::PluginWindowHandle compositing_surface, | |
| 475 int32 opener_id, | 473 int32 opener_id, |
| 476 const RendererPreferences& renderer_prefs, | 474 const RendererPreferences& renderer_prefs, |
| 477 const WebPreferences& webkit_prefs, | 475 const WebPreferences& webkit_prefs, |
| 478 SharedRenderViewCounter* counter, | 476 SharedRenderViewCounter* counter, |
| 479 int32 routing_id, | 477 int32 routing_id, |
| 480 int64 session_storage_namespace_id, | 478 int64 session_storage_namespace_id, |
| 481 const string16& frame_name) { | 479 const string16& frame_name) { |
| 482 DCHECK(routing_id != MSG_ROUTING_NONE); | 480 DCHECK(routing_id != MSG_ROUTING_NONE); |
| 483 return new RenderView( | 481 return new RenderView( |
| 484 render_thread, | 482 render_thread, |
| 485 parent_hwnd, | 483 parent_hwnd, |
| 486 compositing_surface, | |
| 487 opener_id, | 484 opener_id, |
| 488 renderer_prefs, | 485 renderer_prefs, |
| 489 webkit_prefs, | 486 webkit_prefs, |
| 490 counter, | 487 counter, |
| 491 routing_id, | 488 routing_id, |
| 492 session_storage_namespace_id, | 489 session_storage_namespace_id, |
| 493 frame_name); // adds reference | 490 frame_name); // adds reference |
| 494 } | 491 } |
| 495 | 492 |
| 496 // static | 493 // static |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 | 1271 |
| 1275 render_thread_->Send( | 1272 render_thread_->Send( |
| 1276 new ViewHostMsg_CreateWindow(params, | 1273 new ViewHostMsg_CreateWindow(params, |
| 1277 &routing_id, | 1274 &routing_id, |
| 1278 &cloned_session_storage_namespace_id)); | 1275 &cloned_session_storage_namespace_id)); |
| 1279 if (routing_id == MSG_ROUTING_NONE) | 1276 if (routing_id == MSG_ROUTING_NONE) |
| 1280 return NULL; | 1277 return NULL; |
| 1281 | 1278 |
| 1282 RenderView* view = RenderView::Create(render_thread_, | 1279 RenderView* view = RenderView::Create(render_thread_, |
| 1283 0, | 1280 0, |
| 1284 gfx::kNullPluginWindow, | |
| 1285 routing_id_, | 1281 routing_id_, |
| 1286 renderer_preferences_, | 1282 renderer_preferences_, |
| 1287 webkit_preferences_, | 1283 webkit_preferences_, |
| 1288 shared_popup_counter_, | 1284 shared_popup_counter_, |
| 1289 routing_id, | 1285 routing_id, |
| 1290 cloned_session_storage_namespace_id, | 1286 cloned_session_storage_namespace_id, |
| 1291 frame_name); | 1287 frame_name); |
| 1292 view->opened_by_user_gesture_ = params.user_gesture; | 1288 view->opened_by_user_gesture_ = params.user_gesture; |
| 1293 | 1289 |
| 1294 // Record whether the creator frame is trying to suppress the opener field. | 1290 // Record whether the creator frame is trying to suppress the opener field. |
| (...skipping 2960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4255 const webkit_glue::CustomContextMenuContext& custom_context) { | 4251 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 4256 if (custom_context.is_pepper_menu) | 4252 if (custom_context.is_pepper_menu) |
| 4257 pepper_delegate_.OnContextMenuClosed(custom_context); | 4253 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 4258 else | 4254 else |
| 4259 context_menu_node_.reset(); | 4255 context_menu_node_.reset(); |
| 4260 } | 4256 } |
| 4261 | 4257 |
| 4262 void RenderView::OnNetworkStateChanged(bool online) { | 4258 void RenderView::OnNetworkStateChanged(bool online) { |
| 4263 WebNetworkStateNotifier::setOnLine(online); | 4259 WebNetworkStateNotifier::setOnLine(online); |
| 4264 } | 4260 } |
| OLD | NEW |