~abreu-alexandre/oxide/add-ua-to-downloadrequested

« back to all changes in this revision

Viewing changes to shared/browser/oxide_web_view.cc

  • Committer: Chris Coulson
  • Date: 2014-07-18 22:41:10 UTC
  • mfrom: (640.1.18 canary)
  • Revision ID: chris.coulson@canonical.com-20140718224110-z2gzn68mk8ti3u2j
Bump Chromium rev to 38.0.2096.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "base/supports_user_data.h"
29
29
#include "content/browser/frame_host/frame_tree.h"
30
30
#include "content/browser/frame_host/frame_tree_node.h"
 
31
#include "content/browser/frame_host/render_frame_host_impl.h"
31
32
#include "content/browser/gpu/gpu_data_manager_impl.h"
32
33
#include "content/browser/renderer_host/render_view_host_impl.h"
33
34
#include "content/browser/renderer_host/render_widget_host_impl.h"
51
52
#include "content/public/common/favicon_url.h"
52
53
#include "content/public/common/menu_item.h"
53
54
#include "content/public/common/url_constants.h"
 
55
#include "content/public/common/web_preferences.h"
54
56
#include "net/base/net_errors.h"
55
57
#include "third_party/WebKit/public/platform/WebGestureDevice.h"
56
58
#include "third_party/WebKit/public/web/WebInputEvent.h"
61
63
#include "ui/gl/gl_implementation.h"
62
64
#include "url/gurl.h"
63
65
#include "url/url_constants.h"
64
 
#include "webkit/common/webpreferences.h"
65
66
 
66
67
#include "shared/base/oxide_event_utils.h"
67
68
#include "shared/browser/compositor/oxide_compositor.h"
186
187
 
187
188
bool HasMobileViewport(const cc::CompositorFrameMetadata& frame_metadata) {
188
189
  float window_width_dip =
189
 
      frame_metadata.page_scale_factor * frame_metadata.viewport_size.width();
 
190
      frame_metadata.page_scale_factor *
 
191
      frame_metadata.scrollable_viewport_size.width();
190
192
  float content_width_css = frame_metadata.root_layer_size.width();
191
193
  return content_width_css <= window_width_dip + kMobileViewportWidthEpsilon;
192
194
}
574
576
}
575
577
 
576
578
void WebView::DidStartProvisionalLoadForFrame(
577
 
    int64 frame_id,
578
 
    int64 parent_frame_id,
579
 
    bool is_main_frame,
 
579
    content::RenderFrameHost* render_frame_host,
580
580
    const GURL& validated_url,
581
581
    bool is_error_frame,
582
 
    bool is_iframe_srcdoc,
583
 
    content::RenderViewHost* render_view_host) {
584
 
  if (!is_main_frame) {
 
582
    bool is_iframe_srcdoc) {
 
583
  if (render_frame_host->GetParent()) {
585
584
    return;
586
585
  }
587
586
 
589
588
}
590
589
 
591
590
void WebView::DidCommitProvisionalLoadForFrame(
592
 
    int64 frame_id,
593
 
    const base::string16& frame_unique_name,
594
 
    bool is_main_frame,
 
591
    content::RenderFrameHost* render_frame_host,
595
592
    const GURL& url,
596
 
    content::PageTransition transition_type,
597
 
    content::RenderViewHost* render_view_host) {
598
 
  content::FrameTreeNode* node =
599
 
      web_contents_->GetFrameTree()->FindByRoutingID(
600
 
        frame_id, render_view_host->GetProcess()->GetID());
601
 
  DCHECK(node);
602
 
 
603
 
  WebFrame* frame = WebFrame::FromFrameTreeNode(node);
 
593
    content::PageTransition transition_type) {
 
594
  WebFrame* frame = WebFrame::FromFrameTreeNode(
 
595
      static_cast<content::RenderFrameHostImpl *>(
 
596
        render_frame_host)->frame_tree_node());
604
597
  if (frame) {
605
598
    frame->URLChanged();
606
599
  }
607
600
}
608
601
 
609
602
void WebView::DidFailProvisionalLoad(
610
 
    int64 frame_id,
611
 
    const base::string16& frame_unique_name,
612
 
    bool is_main_frame,
 
603
    content::RenderFrameHost* render_frame_host,
613
604
    const GURL& validated_url,
614
605
    int error_code,
615
 
    const base::string16& error_description,
616
 
    content::RenderViewHost* render_view_host) {
617
 
  if (!is_main_frame) {
 
606
    const base::string16& error_description) {
 
607
  if (render_frame_host->GetParent()) {
618
608
    return;
619
609
  }
620
610
 
621
611
  DispatchLoadFailed(validated_url, error_code, error_description);
622
612
}
623
613
 
624
 
void WebView::DidFinishLoad(int64 frame_id,
625
 
                            const GURL& validated_url,
626
 
                            bool is_main_frame,
627
 
                            content::RenderViewHost* render_view_host) {
628
 
  if (!is_main_frame) {
 
614
void WebView::DidFinishLoad(content::RenderFrameHost* render_frame_host,
 
615
                            const GURL& validated_url) {
 
616
  if (render_frame_host->GetParent()) {
629
617
    return;
630
618
  }
631
619
 
632
620
  OnLoadSucceeded(validated_url);
633
621
}
634
622
 
635
 
void WebView::DidFailLoad(int64 frame_id,
 
623
void WebView::DidFailLoad(content::RenderFrameHost* render_frame_host,
636
624
                          const GURL& validated_url,
637
 
                          bool is_main_frame,
638
625
                          int error_code,
639
 
                          const base::string16& error_description,
640
 
                          content::RenderViewHost* render_view_host) {
641
 
  if (!is_main_frame) {
 
626
                          const base::string16& error_description) {
 
627
  if (render_frame_host->GetParent()) {
642
628
    return;
643
629
  }
644
630
 
653
639
  OnNavigationEntryCommitted();
654
640
}
655
641
 
656
 
void WebView::FrameDetached(content::RenderViewHost* rvh,
657
 
                            int64 frame_routing_id) {
 
642
void WebView::FrameDetached(content::RenderFrameHost* render_frame_host) {
658
643
  if (!root_frame_) {
659
644
    return;
660
645
  }
661
646
 
662
 
  content::FrameTreeNode* node =
663
 
      web_contents_->GetFrameTree()->FindByRoutingID(
664
 
        frame_routing_id, rvh->GetProcess()->GetID());
665
 
  DCHECK(node);
666
 
 
667
 
  WebFrame* frame = WebFrame::FromFrameTreeNode(node);
 
647
  WebFrame* frame = WebFrame::FromRenderFrameHost(render_frame_host);
 
648
  DCHECK(frame);
668
649
  frame->Destroy();
669
650
}
670
651