summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_dom_ui.cc
blob: ed5abb9624c0cc6fd38f49477aa674addedbe2bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/extensions/extension_dom_ui.h"

#include "chrome/browser/browser.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/bindings_policy.h"

ExtensionDOMUI::ExtensionDOMUI(TabContents* tab_contents)
    : DOMUI(tab_contents) {
  // TODO(aa): It would be cool to show the extension's icon in here.
  hide_favicon_ = true;
  should_hide_url_ = true;
  bindings_ = BindingsPolicy::EXTENSION;
}

void ExtensionDOMUI::RenderViewCreated(RenderViewHost* render_view_host) {
  extension_function_dispatcher_.reset(
      new ExtensionFunctionDispatcher(render_view_host, this,
                                      tab_contents()->GetURL()));
}

void ExtensionDOMUI::RenderViewReused(RenderViewHost* render_view_host) {
  extension_function_dispatcher_.reset(
      new ExtensionFunctionDispatcher(render_view_host, this,
                                      tab_contents()->GetURL()));
}

void ExtensionDOMUI::ProcessDOMUIMessage(const std::string& message,
                                         const std::string& content,
                                         int request_id,
                                         bool has_callback) {
  extension_function_dispatcher_->HandleRequest(message, content, request_id,
                                                has_callback);
}

Browser* ExtensionDOMUI::GetBrowser() {
  return static_cast<Browser*>(tab_contents()->delegate());
}