2013-03-14 13:03:50 +00:00
|
|
|
// Copyright (c) 2012 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-CHROMIUM file.
|
|
|
|
|
|
|
|
#include "common/content_client.h"
|
|
|
|
|
2013-04-08 16:41:30 +00:00
|
|
|
#include "common/application_info.h"
|
2013-03-14 13:03:50 +00:00
|
|
|
|
2013-04-08 16:41:30 +00:00
|
|
|
#include "base/stringprintf.h"
|
2013-04-08 16:42:37 +00:00
|
|
|
#include "base/string_util.h"
|
2013-03-14 13:03:50 +00:00
|
|
|
#include "ui/base/resource/resource_bundle.h"
|
|
|
|
#include "webkit/user_agent/user_agent_util.h"
|
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
|
|
|
ContentClient::ContentClient() {
|
|
|
|
}
|
|
|
|
|
|
|
|
ContentClient::~ContentClient() {
|
|
|
|
}
|
|
|
|
|
2013-04-08 16:41:30 +00:00
|
|
|
std::string ContentClient::GetProduct() const {
|
2013-04-08 16:42:37 +00:00
|
|
|
auto name = GetApplicationName();
|
|
|
|
RemoveChars(name, kWhitespaceASCII, &name);
|
|
|
|
return base::StringPrintf("%s/%s", name.c_str(), GetApplicationVersion().c_str());
|
2013-04-08 16:41:30 +00:00
|
|
|
}
|
|
|
|
|
2013-03-14 13:03:50 +00:00
|
|
|
std::string ContentClient::GetUserAgent() const {
|
2013-04-08 16:41:30 +00:00
|
|
|
return webkit_glue::BuildUserAgentFromProduct(GetProduct());
|
2013-03-14 13:03:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
base::StringPiece ContentClient::GetDataResource(int resource_id, ui::ScaleFactor scale_factor) const {
|
|
|
|
return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(resource_id, scale_factor);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|