2012-04-03 03:34:16 +02: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 file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_COMMON_CONTENT_CLIENT_H_
|
|
|
|
#define CEF_LIBCEF_COMMON_CONTENT_CLIENT_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "include/cef_app.h"
|
|
|
|
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "content/public/common/content_client.h"
|
2012-05-18 17:04:56 +02:00
|
|
|
#include "ui/base/resource/resource_bundle.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-05-18 17:04:56 +02:00
|
|
|
class CefContentClient : public content::ContentClient,
|
|
|
|
public ui::ResourceBundle::Delegate {
|
2012-04-03 03:34:16 +02:00
|
|
|
public:
|
|
|
|
explicit CefContentClient(CefRefPtr<CefApp> application);
|
|
|
|
virtual ~CefContentClient();
|
|
|
|
|
|
|
|
// Returns the singleton CefContentClient instance.
|
|
|
|
static CefContentClient* Get();
|
|
|
|
|
2012-05-18 17:04:56 +02:00
|
|
|
// content::ContentClient methods.
|
2012-04-24 20:01:48 +02:00
|
|
|
virtual void AddAdditionalSchemes(
|
|
|
|
std::vector<std::string>* standard_schemes,
|
|
|
|
std::vector<std::string>* savable_schemes) OVERRIDE;
|
2012-04-11 20:00:55 +02:00
|
|
|
virtual std::string GetUserAgent() const OVERRIDE;
|
2012-04-03 03:34:16 +02:00
|
|
|
virtual string16 GetLocalizedString(int message_id) const OVERRIDE;
|
2012-05-31 17:19:33 +02:00
|
|
|
virtual base::StringPiece GetDataResource(
|
|
|
|
int resource_id,
|
|
|
|
ui::ScaleFactor scale_factor) const OVERRIDE;
|
2012-08-04 02:59:58 +02:00
|
|
|
virtual gfx::Image& GetNativeImageNamed(int resource_id) const OVERRIDE;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-09-26 02:09:05 +02:00
|
|
|
#if defined(OS_MACOSX) && !defined(OS_IOS)
|
|
|
|
virtual std::string GetCarbonInterposePath() const OVERRIDE;
|
|
|
|
#endif
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
CefRefPtr<CefApp> application() const { return application_; }
|
|
|
|
|
|
|
|
void set_pack_loading_disabled(bool val) { pack_loading_disabled_ = val; }
|
|
|
|
bool pack_loading_disabled() const { return pack_loading_disabled_; }
|
2012-05-18 17:04:56 +02:00
|
|
|
void set_allow_pack_file_load(bool val) { allow_pack_file_load_ = val; }
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
private:
|
2012-05-18 17:04:56 +02:00
|
|
|
// ui::ResourceBundle::Delegate methods.
|
2013-02-23 01:43:28 +01:00
|
|
|
virtual base::FilePath GetPathForResourcePack(
|
|
|
|
const base::FilePath& pack_path,
|
2012-05-31 17:19:33 +02:00
|
|
|
ui::ScaleFactor scale_factor) OVERRIDE;
|
2013-02-23 01:43:28 +01:00
|
|
|
virtual base::FilePath GetPathForLocalePack(
|
|
|
|
const base::FilePath& pack_path,
|
|
|
|
const std::string& locale) OVERRIDE;
|
2012-05-18 17:04:56 +02:00
|
|
|
virtual gfx::Image GetImageNamed(int resource_id) OVERRIDE;
|
|
|
|
virtual gfx::Image GetNativeImageNamed(
|
|
|
|
int resource_id,
|
|
|
|
ui::ResourceBundle::ImageRTL rtl) OVERRIDE;
|
|
|
|
virtual base::RefCountedStaticMemory* LoadDataResourceBytes(
|
2012-05-31 17:19:33 +02:00
|
|
|
int resource_id,
|
|
|
|
ui::ScaleFactor scale_factor) OVERRIDE;
|
2012-05-18 17:04:56 +02:00
|
|
|
virtual bool GetRawDataResource(int resource_id,
|
2012-05-31 17:19:33 +02:00
|
|
|
ui::ScaleFactor scale_factor,
|
2012-05-18 17:04:56 +02:00
|
|
|
base::StringPiece* value) OVERRIDE;
|
|
|
|
virtual bool GetLocalizedString(int message_id, string16* value) OVERRIDE;
|
|
|
|
virtual scoped_ptr<gfx::Font> GetFont(
|
|
|
|
ui::ResourceBundle::FontStyle style) OVERRIDE;
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
CefRefPtr<CefApp> application_;
|
|
|
|
bool pack_loading_disabled_;
|
2012-05-18 17:04:56 +02:00
|
|
|
bool allow_pack_file_load_;
|
2012-04-03 03:34:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_COMMON_CONTENT_CLIENT_H_
|