PSA: src/chrome/browser/ui - what it is and how to use it!

43 views
Skip to first unread message

Ben Goodger (Google)

unread,
Dec 2, 2010, 3:00:30 PM12/2/10
to Chromium-dev
I have been building a new directory structure within src/chrome/browser/. The idea is to get files more organized and the codebase more modular.

One effect of this is the creation of a "ui" directory within browser/.

Isn't the entire browser/ directory about UI? Well not really. The directories under src/chrome are supposed to map 1:1 to a particular process in Chrome's process model, that's why we have browser, renderer, plugin, etc. src/chrome/common exists to hold code that is supposed to be used across multiple processes. src/chrome/app is special exe bootstrap stuff.

There is a lot of code in browser/ that is not related to the Chrome browser UI. So I began to move that which is into the ui subdirectory. Note that there can be code in src/chrome/browser/ui that isn't a "view" in the MVC sense - it can also include the models and controllers for UI features, such as the Browser object, the TabStripModel, etc.

Some code I am leaving out of ui/ for now because it seems potentially lower level, like Profile.

As you create new files that have UI, place them in chrome/browser/ui if they are cross platform (in a subdir if there are or will be a lot of related files), or in one of the frontend specific sub-subdirs (cocoa, gtk, views).

In the longer term (not required for this stage) it'd be nice if the hierarchy within browser/ui was reflected down into the FE subdirs (e.g. browser/ui/tab_strip and browser/ui/views/tab_strip).

-Ben

Darin Fisher

unread,
Dec 2, 2010, 3:31:56 PM12/2/10
to b...@chromium.org, Chromium-dev
This sounds great!  Are there any restrictions on what you may include from browser/ui/ or on who may include headers from browser/ui/?

-Darin



--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Ben Goodger (Google)

unread,
Dec 2, 2010, 4:06:17 PM12/2/10
to Darin Fisher, Chromium-dev
Once all related refactorings are complete:

src/chrome/browser should not include src/chrome/browser/ui
src/chrome/browser/ui should not include headers from FE-specific subdirs (views, cocoa, gtk)

-Ben

Paweł Hajdan, Jr.

unread,
Dec 3, 2010, 2:55:11 AM12/3/10
to b...@chromium.org, Chromium-dev
On Thu, Dec 2, 2010 at 21:00, Ben Goodger (Google) <b...@chromium.org> wrote:
As you create new files that have UI, place them in chrome/browser/ui if they are cross platform (in a subdir if there are or will be a lot of related files), or in one of the frontend specific sub-subdirs (cocoa, gtk, views).

Reply all
Reply to author
Forward
0 new messages