Commit 6e37c541 authored by sadrul@chromium.org's avatar sadrul@chromium.org

athena: Show the theme-color in the title strip, and fix the height.

If the web-page specifies a color using the 'theme-color' meta-tag, then use
that color to paint the background of the window-title.

Fix the height of the title to be 25px.

BUG=401569
R=oshima@chromium.org

Review URL: https://codereview.chromium.org/455773003

Cr-Commit-Position: refs/heads/master@{#288420}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288420 0039d316-1c4b-4281-b951-d872f2087c98
parent 99122f04
...@@ -96,7 +96,8 @@ void ActivityFrameView::Layout() { ...@@ -96,7 +96,8 @@ void ActivityFrameView::Layout() {
// ActivityFrameView, private: // ActivityFrameView, private:
int ActivityFrameView::NonClientTopBorderHeight() const { int ActivityFrameView::NonClientTopBorderHeight() const {
return frame_->IsFullscreen() ? 0 : title_->GetPreferredSize().height(); const int kDefaultTitleHeight = 25;
return frame_->IsFullscreen() ? 0 : kDefaultTitleHeight;
} }
} // namespace ash } // namespace ash
...@@ -120,6 +120,9 @@ class WebActivityController : public AcceleratorHandler { ...@@ -120,6 +120,9 @@ class WebActivityController : public AcceleratorHandler {
DISALLOW_COPY_AND_ASSIGN(WebActivityController); DISALLOW_COPY_AND_ASSIGN(WebActivityController);
}; };
const SkColor kDefaultTitleColor = SK_ColorGRAY;
const SkColor kDefaultUnavailableColor = SkColorSetRGB(0xbb, 0x77, 0x77);
} // namespace } // namespace
// A web view for athena's web activity. Note that AthenaWebView will create its // A web view for athena's web activity. Note that AthenaWebView will create its
...@@ -261,6 +264,7 @@ WebActivity::WebActivity(content::BrowserContext* browser_context, ...@@ -261,6 +264,7 @@ WebActivity::WebActivity(content::BrowserContext* browser_context,
: browser_context_(browser_context), : browser_context_(browser_context),
url_(url), url_(url),
web_view_(NULL), web_view_(NULL),
title_color_(kDefaultTitleColor),
current_state_(ACTIVITY_UNLOADED) { current_state_(ACTIVITY_UNLOADED) {
} }
...@@ -349,7 +353,7 @@ void WebActivity::Init() { ...@@ -349,7 +353,7 @@ void WebActivity::Init() {
SkColor WebActivity::GetRepresentativeColor() const { SkColor WebActivity::GetRepresentativeColor() const {
// TODO(sad): Compute the color from the favicon. // TODO(sad): Compute the color from the favicon.
return web_view_ ? SK_ColorGRAY : SkColorSetRGB(0xbb, 0x77, 0x77); return web_view_ ? title_color_ : kDefaultUnavailableColor;
} }
base::string16 WebActivity::GetTitle() const { base::string16 WebActivity::GetTitle() const {
...@@ -389,4 +393,8 @@ void WebActivity::DidUpdateFaviconURL( ...@@ -389,4 +393,8 @@ void WebActivity::DidUpdateFaviconURL(
ActivityManager::Get()->UpdateActivity(this); ActivityManager::Get()->UpdateActivity(this);
} }
void WebActivity::DidChangeThemeColor(SkColor theme_color) {
title_color_ = theme_color;
}
} // namespace athena } // namespace athena
...@@ -54,11 +54,13 @@ class WebActivity : public Activity, ...@@ -54,11 +54,13 @@ class WebActivity : public Activity,
bool explicit_set) OVERRIDE; bool explicit_set) OVERRIDE;
virtual void DidUpdateFaviconURL( virtual void DidUpdateFaviconURL(
const std::vector<content::FaviconURL>& candidates) OVERRIDE; const std::vector<content::FaviconURL>& candidates) OVERRIDE;
virtual void DidChangeThemeColor(SkColor theme_color) OVERRIDE;
private: private:
content::BrowserContext* browser_context_; content::BrowserContext* browser_context_;
const GURL url_; const GURL url_;
AthenaWebView* web_view_; AthenaWebView* web_view_;
SkColor title_color_;
// The current state for this activity. // The current state for this activity.
ActivityState current_state_; ActivityState current_state_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment