Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / managed_mode / managed_mode_navigation_observer.h
blobd72e5e17013a7b7b9c3d8971e26ee8d0c3643d1f
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_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_
8 #include <set>
9 #include <vector>
11 #include "base/memory/scoped_vector.h"
12 #include "base/values.h"
13 #include "chrome/browser/managed_mode/managed_users.h"
14 #include "content/public/browser/web_contents_observer.h"
15 #include "content/public/browser/web_contents_user_data.h"
17 class InfoBar;
18 class ManagedModeURLFilter;
19 class ManagedUserService;
21 namespace content {
22 class NavigationEntry;
25 class ManagedModeNavigationObserver
26 : public content::WebContentsObserver,
27 public content::WebContentsUserData<ManagedModeNavigationObserver> {
28 public:
29 virtual ~ManagedModeNavigationObserver();
31 // Sets the specific infobar as dismissed.
32 void WarnInfoBarDismissed();
34 const std::vector<const content::NavigationEntry*>*
35 blocked_navigations() const {
36 return &blocked_navigations_.get();
39 // Called when a network request to |url| is blocked.
40 static void OnRequestBlocked(int render_process_host_id,
41 int render_view_id,
42 const GURL& url,
43 const base::Callback<void(bool)>& callback);
45 private:
46 friend class content::WebContentsUserData<ManagedModeNavigationObserver>;
48 explicit ManagedModeNavigationObserver(content::WebContents* web_contents);
50 // content::WebContentsObserver implementation.
51 virtual void ProvisionalChangeToMainFrameUrl(
52 const GURL& url,
53 content::RenderFrameHost* render_frame_host) OVERRIDE;
54 virtual void DidCommitProvisionalLoadForFrame(
55 int64 frame_id,
56 const base::string16& frame_unique_name,
57 bool is_main_frame,
58 const GURL& url,
59 content::PageTransition transition_type,
60 content::RenderViewHost* render_view_host) OVERRIDE;
62 void OnRequestBlockedInternal(const GURL& url);
64 // Owned by the profile, so outlives us.
65 ManagedUserService* managed_user_service_;
67 // Owned by ManagedUserService.
68 const ManagedModeURLFilter* url_filter_;
70 // Owned by the InfoBarService, which has the same lifetime as this object.
71 InfoBar* warn_infobar_;
73 ScopedVector<const content::NavigationEntry> blocked_navigations_;
75 DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver);
78 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_NAVIGATION_OBSERVER_H_