Google Chrome android应用的源代码? [英] Source code of Google Chrome android app?

查看:199
本文介绍了Google Chrome android应用的源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建一个与谷歌浏览器的android版本有相似之处的用户界面。我如何建立自己的Android版Google chrome?

解决方案

我对潜水的建议是看看 http://code.google.com/p/chromiumembedded/ 的来源。



这是Chrome的精简版本,如果您查看它特别使用的文件,包括其源代码树中包含的文件或包含在Chromium回购中的文件。 Chromium代码库是大量的东西,其中大部分实际上并不在浏览器中。有很多来自第三方回购的代码,然后在构建过程中被淘汰,或者Chromium的实现位于树的其他地方,还有很多副项目(虽然有趣并且是一个很棒的资源,东西)将阻止你实现特定的浏览器实现的目标,以及它们如何组合在一起。



CEF非常棒,因为你可以看到已经完成了将所有这些东西放在一起以在浏览器视图中非常明确地构建项目的过程,而不是其他任何东西。您可以很容易地看到哪些部分主要来源于webkit,您可以看到Google的实施中出现了哪些交叉点,并且您可以很轻松地看到V8如何进入混合。



我相对而言很容易,因为我们仍然在谈论大量的代码。 CEF会让你置身于需求的中心,但这些东西仍然从树的其他部分吸收大量各种各样的东西。编译它需要花费大约一个小时的时间,在一台配备12个RAM和8个内核的非常棒的计算机上,生成的文件占用6到10个小时。



在至少,不会有任何一种快速跳入浅端的东西在这里或那里零零碎碎。浏览器是必不可少的复杂工程,因为它们必须包含如此大量的单个功能,然后将它们组合到共享的上下文中。你可能会发现你正在寻找的一件事,但是你会发现它是一个类库的一部分,它可能由几十或几百个文件组成,而这些文件又依靠另外一百个这样的库来处理每个任务,所以要真正拿走一些东西,你必须承诺时间来获取比任何给定的信息更多的东西。



编辑:哦也作为你的具体例子。



是根目录 http://src.chromium .org / viewvc / chrome / trunk / src

/ chrome http://src.chromium.org/viewvc/chrome/trunk/src/chrome



chrome树主要包含直接实现(尽管大部分内容不在其中,但大部分内容甚至包含在内,但这就是起点)。这与chromeos有着重叠的地方(chromeos是铬浏览器的一种极其疯狂的极端)

/ chrome / browser http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/



让你接近你想要的位置。你开始看到你可以匹配到浏览器的具体参考,比如标签和whatnot(忽略了实际浏览器实现本身的巨大象征,它占据了所有这些东西的大部分思想空间)



/ chrome / browser / ui http ://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/



带你到大部分的用户界面代码是针对浏览器的。这可能会让人困惑,当交叉或者移植东西的时候,比如根src目录中有一个ui,它有一些交叉。

最后http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ ui / omnibox /



其中的代码量非常少。但这是你发现的很多。这里的代码是在别处构建的许多类的实现。对于非webview gui组件,您会发现它们大多指向根ui和本地小部件,这是实际事件处理代码的大部分,如果我没有记错的话。


I wanted to build a UI which has similarities to Google chrome's android version . How can I build the android version of Google chrome myself?

解决方案

My recommendation for sort of diving in is to take a look at the source for http://code.google.com/p/chromiumembedded/.

It's sort of the condensed version of Chrome and if you look at the files it specifically uses, either ones included in its source tree, or files included therein from the Chromium repo at large. The Chromium code base is a huge amount of stuff, most of which isn't actually in the browser. There's a ton of pulled in code from third party repos which are then boiled down in the build process or Chromium's implementation is located somewhere else in the tree, there's a lot of side projects that (while interesting and an awesome resource for a wide breadth of stuff) will prevent you from achieving your goal of specifically honing in on the browser implementation and how that fits together.

CEF is great because you can see someone who's already done the process of pulling all that stuff together to build a project very specifically scoped at the browser view and nothing else. You can see which parts are primarily derived from webkit easily, you can see where the crossover comes in with Google's implementations, and you can see pretty easily how V8 gets tossed into the mix.

I do say "easily" in relative terms because we're still talking a huge amount of code overall. CEF will put you smack in the center of the requirements, but that stuff is still pulling in the massive amount of various things from the rest of the tree. Compiling it takes me about an hour on a really good computer with 12 gigs of ram and 8 cores, and the generated files take up like 6-10 gigs depending.

At the very least, there's not going to be any sort of quick jump into the shallow end to pick something here or there piecemeal. Browsers are incredibly complex pieces of engineering necessarily, because they have to subsume such a huge amount of individual pieces of functionality and then combine them into a shared context. You may find the one thing you're looking for, but you'll find that it's part of a class library that likely is composed of dozens or hundreds of files, which in turn relies on a hundred more of these libraries to handle each task, so to really take something away you'll have to commit time to taking in a lot more than any given piece of information.

Edit: oh also as your specific example.

src is root http://src.chromium.org/viewvc/chrome/trunk/src

/chrome http://src.chromium.org/viewvc/chrome/trunk/src/chrome

The "chrome" tree largely contains the direct implementations (a lot of stuff isn't in there though, most of it even, but that's the starting point). This has overlap with chromeos (chromeos is kind of chromium browser taken to a crazy extreme)

/chrome/browser http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/

Is getting you to close to where you want to be. You start to see specific references to things that you can match to the browser, like the tabs and whatnot (ignoring the giant elephant of the actual browser implementation itself which is what takes up the majority of the mindspace in all this stuff)

/chrome/browser/ui http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/

Brings you to where most of the ui code is for the browser. It can be confusing when there's crossover or when stuff migrates, like there's a "ui" in the root src directory which has some crossover.

And finally http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/omnibox/

Which has a surprisingly small amount of code in it. But this is what you find a lot. The code here is an implementation of a number of classes that are built up elsewhere. For non-webview gui component you'll find them mostly pointing back to the root "ui" and the native widgets stuff there, which is where the bulk of the actual event handling code is if I remember correctly.

这篇关于Google Chrome android应用的源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆