Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / webui / uber / uber_ui.h
blobe8e7f38f2609b9a54597e929175d9cb57a4a0480
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_UI_WEBUI_UBER_UBER_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_
8 #include <string>
10 #include "base/memory/scoped_vector.h"
11 #include "base/values.h"
12 #include "chrome/browser/profiles/profile.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "content/public/browser/web_ui_controller.h"
17 // The WebUI class for the uber page (chrome://chrome). It manages the UI for
18 // the uber page (navigation bar and so forth) as well as WebUI objects for
19 // pages that appear in the uber page.
20 class UberUI : public content::WebUIController {
21 public:
22 explicit UberUI(content::WebUI* web_ui);
23 virtual ~UberUI();
25 // WebUIController implementation.
26 virtual bool OverrideHandleWebUIMessage(const GURL& source_url,
27 const std::string& message,
28 const base::ListValue& args) OVERRIDE;
30 // We forward these to |sub_uis_|.
31 virtual void RenderViewCreated(
32 content::RenderViewHost* render_view_host) OVERRIDE;
33 virtual void RenderViewReused(
34 content::RenderViewHost* render_view_host) OVERRIDE;
36 private:
37 // A map from URL origin to WebUI instance.
38 typedef std::map<std::string, content::WebUI*> SubpageMap;
40 // Creates and stores a WebUI for the given URL.
41 void RegisterSubpage(const std::string& page_url);
43 // The WebUI*s in this map are owned.
44 SubpageMap sub_uis_;
46 DISALLOW_COPY_AND_ASSIGN(UberUI);
49 class UberFrameUI : public content::NotificationObserver,
50 public content::WebUIController {
51 public:
52 explicit UberFrameUI(content::WebUI* web_ui);
53 virtual ~UberFrameUI();
55 private:
56 // content::NotificationObserver implementation.
57 virtual void Observe(int type,
58 const content::NotificationSource& source,
59 const content::NotificationDetails& details) OVERRIDE;
61 content::NotificationRegistrar registrar_;
63 DISALLOW_COPY_AND_ASSIGN(UberFrameUI);
66 #endif // CHROME_BROWSER_UI_WEBUI_UBER_UBER_UI_H_