pacificIT / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 1 forks source link

Building CEF3 on Linux #604

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I've tried to build CEF3 on xUbuntu 12.04 LTS 64bit. I used the latest sources 
from both Chromium and CEF.
I arranged the two libraries so that the cef folders (cef1, and cef3) are in 
chromium's src.
This way the shell script found the stuff it needed from the chrome folder, and 
the src folder as well.

I successfully managed to build both, but I had to make changes that made me 
think that the latest versions don't get along really well.

So here's the list:
-cef3/tools/gyp_cef: line 154
[...]
args.append('--depth=..')

# Off we go...
sys.exit(gyp.main(args))
[EOF]
this makes sure that the src folder is found, so that the gyp_cef script 
searches for chromium in cef3/../

-tools/gritsettings/resource_ids: line 200
[...]
  "cef3/libcef/resources/cef_resources.grd": {
    "includes": [27000],
  },
  "cef3/libcef/resources/cef_strings.grd": {
    "messages": [28000],
  },
}
[EOF]
this was needed because while building the library it complained about these 
lines missing

content/public/browser/devtools_http_handler.h: line 51
[...]
      CONTENT_EXPORT static DevToolsHttpHandler* Start(
      const std::string& ip,
      int port,
      const std::string& frontend_url,
      net::URLRequestContextGetter* request_context_getter,
      DevToolsHttpHandlerDelegate* delegate);
[...]
this is needed by cef3/libcef/browser/devtools_delegate.cc: line 97

ui/base/accelerators/accelerator.h line 28
[...]
  Accelerator(ui::KeyboardCode, bool&, bool&, bool&);
[...]
this is a missing declaration

cef3/libcef/browser/content_browser_client.h: line 32
[...]
  virtual bool ShouldSwapProcessesForRedirect(content::ResourceContext* resource_context,
                                              const GURL& current_url,
                                              const GURL& new_url) OVERRIDE;
[...]
this is needed by cef3/libcef/common/main_delegate.cc: line 329

cef3/libcef/browser/content_browser_client.cc: line 81
[...]
bool 
CefContentBrowserClient::ShouldSwapProcessesForRedirect(content::ResourceContext
* resource_context,
                                              const GURL& current_url,
                                              const GURL& new_url)
{
  return false;
}
[...]
this is an implementation of the previous. I inserted this so that CEF compiles 
successfully. However I'm sure this should have some functionality, not just 
return false.

Anyways I didn't do any tests as I'm not sure how to test it.

Original issue reported on code.google.com by neke...@msn.com on 24 May 2012 at 5:28

GoogleCodeExporter commented 9 years ago
Sounds like you're not using the correct Chromium revision. You should use the 
Chromium revision specified in the CHROMIUM_BUILD_COMPATIBILITY.txt file. Your 
directory structure should then be as follows:

/path/to/chromium/src/cef <-- either CEF1 or CEF3.

Original comment by magreenb...@gmail.com on 24 May 2012 at 5:35

GoogleCodeExporter commented 9 years ago
oh, ok, I didn't see that :)
I read through the general usage wiki page, and ran the cefclient test app that 
was built and the tests ran pretty smoothly. But I'll switch to the chromium 
version as you suggested. Thanks for the help!

Original comment by neke...@msn.com on 24 May 2012 at 5:40

GoogleCodeExporter commented 9 years ago
ok, so this time I did as you suggested. I dl-ed the chromium version that was 
in the txt file, and began compiling. However this time I ran into way more 
problems than before. I still managed to build it, and the cefclient ran fine 
as well.
Here are the changes I had to do to build cef.

CHANGES:
src/cef3/libcef/browser/browser_main.cc: line 34
  return content::GetContentClient()->GetDataResource(resource_id, ui::SCALE_FACTOR_NONE);

src/cef3/libcef/common/content_client.h: line 45
  virtual FilePath GetPathForResourcePack(const FilePath& pack_path,
                                          ui::ScaleFactor scale_factor = ui::SCALE_FACTOR_NONE) OVERRIDE;
  virtual base::RefCountedStaticMemory* LoadDataResourceBytes(
      int resource_id, ui::ScaleFactor sf = ui::SCALE_FACTOR_NONE) OVERRIDE;
  virtual bool GetRawDataResource(int resource_id, ui::ScaleFactor sf,
                                  base::StringPiece* value) OVERRIDE;
  virtual base::StringPiece GetDataResource(
      int resource_id,
      ui::ScaleFactor scale_factor) const OVERRIDE;
Note: I removed the equivalent declarations of this from private and added them 
to public, then I added the appropriate parameters, so that it didn't complain 
about them not being implemented.

src/cef3/libcef/common/content_client.cc: line 143 (changed the implementations 
of the above)
FilePath CefContentClient::GetPathForResourcePack(const FilePath& pack_path,
                                                  ui::ScaleFactor scale_factor) {
  // Only allow the cef pack file to load.
  if (!pack_loading_disabled_ && allow_pack_file_load_)
    return pack_path;
  return FilePath();
}
line 168:
base::RefCountedStaticMemory* CefContentClient::LoadDataResourceBytes(
    int resource_id, ui::ScaleFactor sf) {
  return NULL;
}
line 173:
bool CefContentClient::GetRawDataResource(int resource_id, ui::ScaleFactor sf,
                                          base::StringPiece* value) {
  if (application_.get()) {
    CefRefPtr<CefResourceBundleHandler> handler =
        application_->GetResourceBundleHandler();
    if (handler.get()) {
      void* data = NULL;
      size_t data_size = 0;
      if (handler->GetDataResource(resource_id, data, data_size))
        *value = base::StringPiece(static_cast<char*>(data), data_size);
    }
  }

  return (pack_loading_disabled_ || !value->empty());
}

src/content/public/common/content_client.h: line 119
  virtual base::StringPiece GetDataResource(
      int resource_id,
      ui::ScaleFactor scale_factor = ui::SCALE_FACTOR_NONE) const = 0;

src/cef3/libcef/browser/menu_model_impl.cc: line 77
if (impl_->GetAcceleratorAt(index, key_code, shift_pressed, ctrl_pressed,
                                alt_pressed)) {
      *accelerator = ui::Accelerator(static_cast<ui::KeyboardCode>(key_code),
                                     shift_pressed | ctrl_pressed | alt_pressed); 
Note: I'm not really sure if this works...
line 94:
  virtual bool GetIconAt(int index, gfx::ImageSkia* icon) OVERRIDE {

src/cef3/libcef/browser/url_request_context_getter.cc: line 324
      net::ProxyService::CreateSystemProxyConfigService(0, file_loop_));
Note: this may crash when creating a proxy service...

src/ui/base/resource/resource_bundle.h: line 198
  base::StringPiece GetRawDataResource(int resource_id,
                                       ScaleFactor scale_factor = ui::SCALE_FACTOR_NONE) const;
Note: this was needed, because some function calls were made from cef that 
didn't use the second parameter.

src/cef3/libcef/browser/content_browser_client.h: line 35
  virtual bool ShouldSwapProcessesForRedirect(content::ResourceContext*, const GURL&, const GURL&) OVERRIDE;
  virtual content::WebContentsView* OverrideCreateWebContentsView(
      content::WebContents* web_contents, content::RenderViewHostDelegateView**) OVERRIDE;

src/cef3/libcef/browser/content_browser_client.cc: line 88
bool 
CefContentBrowserClient::ShouldSwapProcessesForRedirect(content::ResourceContext
*, const GURL&, const GURL&)
{
  return false;
}

content::WebContentsView*
    CefContentBrowserClient::OverrideCreateWebContentsView(
        content::WebContents* web_contents, content::RenderViewHostDelegateView**) {
  return NULL;
}
Note: this is the implementation of the above.

src/cef3/libcef/common/main_delegate.cc: line 382
          pak_file, ui::SCALE_FACTOR_100P);

Original comment by neke...@msn.com on 25 May 2012 at 1:00