blob: d525a3b038588e7b8ec34297cc56f3b8aa354c7b [file] [log] [blame]
// Copyright 2015 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "cobalt/dom/dom_settings.h"
#include "cobalt/dom/document.h"
#include "cobalt/dom/url_utils.h"
#include "cobalt/dom/window.h"
namespace cobalt {
namespace dom {
DOMSettings::DOMSettings(
const int max_dom_element_depth, loader::FetcherFactory* fetcher_factory,
network::NetworkModule* network_module,
MediaSourceRegistry* media_source_registry, Blob::Registry* blob_registry,
media::CanPlayTypeHandler* can_play_type_handler,
script::JavaScriptEngine* engine,
script::GlobalEnvironment* global_environment,
const base::DebuggerHooks& debugger_hooks,
MutationObserverTaskManager* mutation_observer_task_manager,
const Options& options)
: max_dom_element_depth_(max_dom_element_depth),
microphone_options_(options.microphone_options),
fetcher_factory_(fetcher_factory),
network_module_(network_module),
media_source_registry_(media_source_registry),
blob_registry_(blob_registry),
can_play_type_handler_(can_play_type_handler),
javascript_engine_(engine),
global_environment_(global_environment),
debugger_hooks_(debugger_hooks),
mutation_observer_task_manager_(mutation_observer_task_manager) {}
DOMSettings::~DOMSettings() {}
void DOMSettings::set_window(const scoped_refptr<Window>& window) {
window_ = window;
}
scoped_refptr<Window> DOMSettings::window() const { return window_; }
const GURL& DOMSettings::base_url() const {
return window()->document()->url_as_gurl();
}
loader::Origin DOMSettings::document_origin() const {
return window()->document()->location()->GetOriginAsObject();
}
} // namespace dom
} // namespace cobalt