Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / chrome / renderer / chrome_render_view_observer.h
blob1d522a043205698935c9b9785bef214d3e75dcd3
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_
6 #define CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "base/memory/linked_ptr.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/timer/timer.h"
16 #include "content/public/common/top_controls_state.h"
17 #include "content/public/renderer/render_view_observer.h"
18 #include "ui/gfx/geometry/size.h"
19 #include "url/gurl.h"
21 class ContentSettingsObserver;
22 class SkBitmap;
23 class WebViewColorOverlay;
24 class WebViewAnimatingOverlay;
26 namespace blink {
27 class WebView;
28 struct WebWindowFeatures;
31 namespace safe_browsing {
32 class PhishingClassifierDelegate;
35 namespace translate {
36 class TranslateHelper;
39 namespace web_cache {
40 class WebCacheRenderProcessObserver;
43 // This class holds the Chrome specific parts of RenderView, and has the same
44 // lifetime.
45 class ChromeRenderViewObserver : public content::RenderViewObserver {
46 public:
47 // translate_helper can be NULL.
48 ChromeRenderViewObserver(
49 content::RenderView* render_view,
50 web_cache::WebCacheRenderProcessObserver*
51 web_cache_render_process_observer);
52 ~ChromeRenderViewObserver() override;
54 private:
55 // RenderViewObserver implementation.
56 bool OnMessageReceived(const IPC::Message& message) override;
57 void DidStartLoading() override;
58 void DidStopLoading() override;
59 void DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
60 bool is_new_navigation) override;
61 void Navigate(const GURL& url) override;
63 #if !defined(OS_ANDROID) && !defined(OS_IOS)
64 void OnWebUIJavaScript(const base::string16& javascript);
65 #endif
66 #if defined(ENABLE_EXTENSIONS)
67 void OnSetVisuallyDeemphasized(bool deemphasized);
68 #endif
69 #if defined(OS_ANDROID)
70 void OnUpdateTopControlsState(content::TopControlsState constraints,
71 content::TopControlsState current,
72 bool animate);
73 void OnRetrieveMetaTagContent(const GURL& expected_url,
74 const std::string tag_name);
75 #endif
76 void OnGetWebApplicationInfo();
77 void OnSetClientSidePhishingDetection(bool enable_phishing_detection);
78 void OnSetWindowFeatures(const blink::WebWindowFeatures& window_features);
80 void CapturePageInfoLater(bool preliminary_capture,
81 base::TimeDelta delay);
83 // Captures the thumbnail and text contents for indexing for the given load
84 // ID. Kicks off analysis of the captured text.
85 void CapturePageInfo(bool preliminary_capture);
87 // Retrieves the text from the given frame contents, the page text up to the
88 // maximum amount kMaxIndexChars will be placed into the given buffer.
89 void CaptureText(blink::WebFrame* frame, base::string16* contents);
91 // Determines if a host is in the strict security host set.
92 bool IsStrictSecurityHost(const std::string& host);
94 // Checks if a page contains <meta http-equiv="refresh" ...> tag.
95 bool HasRefreshMetaTag(blink::WebFrame* frame);
97 // Save the JavaScript to preload if a ViewMsg_WebUIJavaScript is received.
98 std::vector<base::string16> webui_javascript_;
100 // Owned by ChromeContentRendererClient and outlive us.
101 web_cache::WebCacheRenderProcessObserver* web_cache_render_process_observer_;
103 // Have the same lifetime as us.
104 translate::TranslateHelper* translate_helper_;
105 safe_browsing::PhishingClassifierDelegate* phishing_classifier_;
107 // A color page overlay when visually de-emaphasized.
108 scoped_ptr<WebViewColorOverlay> dimmed_color_overlay_;
110 // Used to delay calling CapturePageInfo.
111 base::Timer capture_timer_;
113 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver);
116 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_