Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1536)

Side by Side Diff: chrome/browser/garbled_text_helper.h

Issue 9235004: [Garbled Text][Infobar] Adding infobar to suggest turning on encoding detection. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/garbled_text_browsertest.cc ('k') | chrome/browser/garbled_text_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_GARBLED_TEXT_HELPER_H_
6 #define CHROME_BROWSER_GARBLED_TEXT_HELPER_H_
7 #pragma once
8
9 #include <string>
10 #include <vector>
11
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/garbled_text_url_tracker.h"
14 #include "chrome/browser/prefs/pref_change_registrar.h"
15 #include "content/public/browser/web_contents_observer.h"
16
17 class Profile;
18
19 namespace content {
20 class WebContents;
21 }
22
23 // This class is instantiated per tab and lives on UI thread.
24 // Once containing text of the page is detected as garbled, the instance prompts
25 // the user to enable encoding detection for this site through infobar, and
26 // redirects the approval to |GarbledTextService|.
27 class GarbledTextHelper : public base::SupportsWeakPtr<GarbledTextHelper>,
28 public content::WebContentsObserver,
29 public content::NotificationObserver {
30 public:
31 typedef GarbledTextURLTracker::GarbledURLs GarbledURLs;
32
33 explicit GarbledTextHelper(content::WebContents* web_contents);
34 virtual ~GarbledTextHelper();
35
36 private:
37 friend class GarbledTextHelperTest;
38
39 Profile* GetProfile();
40
41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
42 virtual void DidNavigateAnyFrame(
43 const content::LoadCommittedDetails& details,
44 const content::FrameNavigateParams& params) OVERRIDE;
45 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
46
47 virtual void Observe(int type,
48 const content::NotificationSource& source,
49 const content::NotificationDetails& details) OVERRIDE;
50
51 // Handles |ViewHostMsg_GarbledTextDetected|.
52 void OnGarbledTextDetected(const GarbledURLs& garbled_urls);
53
54 // Completion callback for |GrabledTextService::UpdateBlacklist()|.
55 void WillFinishUpdatingBlacklist();
56
57 void OnEnableStateChanged(bool enabled);
58
59 // Called when the user accepts enabling encoding detection for |garbled_urls|
60 // through infobar.
61 void EnableEncodingDetection(const GarbledURLs& garbled_urls);
62
63 PrefChangeRegistrar pref_change_registrar_;
64
65 DISALLOW_COPY_AND_ASSIGN(GarbledTextHelper);
66 };
67
68 #endif // CHROME_BROWSER_GARBLED_TEXT_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/garbled_text_browsertest.cc ('k') | chrome/browser/garbled_text_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698