Update CrOS OOBE throbber to MD throbber; delete old asset
[chromium-blink-merge.git] / chrome / renderer / chrome_render_view_observer.h
blob22f2fdf5aa2570d277de15e8a925ecd15eaed5b8
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;
24 namespace blink {
25 class WebView;
26 struct WebWindowFeatures;
29 namespace safe_browsing {
30 class PhishingClassifierDelegate;
33 namespace translate {
34 class TranslateHelper;
37 namespace web_cache {
38 class WebCacheRenderProcessObserver;
41 // This class holds the Chrome specific parts of RenderView, and has the same
42 // lifetime.
43 class ChromeRenderViewObserver : public content::RenderViewObserver {
44 public:
45 // translate_helper can be NULL.
46 ChromeRenderViewObserver(
47 content::RenderView* render_view,
48 web_cache::WebCacheRenderProcessObserver*
49 web_cache_render_process_observer);
50 ~ChromeRenderViewObserver() override;
52 private:
53 // RenderViewObserver implementation.
54 bool OnMessageReceived(const IPC::Message& message) override;
55 void DidStartLoading() override;
56 void DidStopLoading() override;
57 void DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
58 bool is_new_navigation) override;
59 void Navigate(const GURL& url) override;
61 #if !defined(OS_ANDROID) && !defined(OS_IOS)
62 void OnWebUIJavaScript(const base::string16& javascript);
63 #endif
64 #if defined(ENABLE_EXTENSIONS)
65 void OnSetVisuallyDeemphasized(bool deemphasized);
66 #endif
67 #if defined(OS_ANDROID)
68 void OnUpdateTopControlsState(content::TopControlsState constraints,
69 content::TopControlsState current,
70 bool animate);
71 #endif
72 void OnGetWebApplicationInfo();
73 void OnSetClientSidePhishingDetection(bool enable_phishing_detection);
74 void OnSetWindowFeatures(const blink::WebWindowFeatures& window_features);
76 void CapturePageInfoLater(bool preliminary_capture,
77 base::TimeDelta delay);
79 // Captures the thumbnail and text contents for indexing for the given load
80 // ID. Kicks off analysis of the captured text.
81 void CapturePageInfo(bool preliminary_capture);
83 // Retrieves the text from the given frame contents, the page text up to the
84 // maximum amount kMaxIndexChars will be placed into the given buffer.
85 void CaptureText(blink::WebFrame* frame, base::string16* contents);
87 // Determines if a host is in the strict security host set.
88 bool IsStrictSecurityHost(const std::string& host);
90 // Checks if a page contains <meta http-equiv="refresh" ...> tag.
91 bool HasRefreshMetaTag(blink::WebFrame* frame);
93 // Save the JavaScript to preload if a ViewMsg_WebUIJavaScript is received.
94 std::vector<base::string16> webui_javascript_;
96 // Owned by ChromeContentRendererClient and outlive us.
97 web_cache::WebCacheRenderProcessObserver* web_cache_render_process_observer_;
99 // Have the same lifetime as us.
100 translate::TranslateHelper* translate_helper_;
101 safe_browsing::PhishingClassifierDelegate* phishing_classifier_;
103 // true if webview is overlayed with grey color.
104 bool webview_visually_deemphasized_;
106 // Used to delay calling CapturePageInfo.
107 base::Timer capture_timer_;
109 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver);
112 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_