Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1400)

Unified Diff: chrome/browser/gtk/extension_shelf_gtk.cc

Issue 174585: Draw background of Linux extension toolstrips. (Closed)
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/extension_shelf_gtk.h ('k') | chrome/browser/gtk/extension_view_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/extension_shelf_gtk.cc
diff --git a/chrome/browser/gtk/extension_shelf_gtk.cc b/chrome/browser/gtk/extension_shelf_gtk.cc
index 121f77dade6f9a9f1ca2f92b29f40b8b87101255..0383dcc7ffd1117df2e0f37d6a4b9a79064c3f01 100644
--- a/chrome/browser/gtk/extension_shelf_gtk.cc
+++ b/chrome/browser/gtk/extension_shelf_gtk.cc
@@ -37,6 +37,10 @@ class ExtensionShelfGtk::Toolstrip {
void AddToolstripToBox(GtkWidget* box);
void RemoveToolstripFromBox(GtkWidget* box);
+ void SetBackground(const SkBitmap& background) {
+ host_->view()->SetBackground(background);
+ }
+
private:
void Init();
@@ -93,7 +97,9 @@ void ExtensionShelfGtk::Hide() {
void ExtensionShelfGtk::ToolstripInsertedAt(ExtensionHost* host,
int index) {
+ InitBackground();
Toolstrip* toolstrip = new Toolstrip(host);
+ toolstrip->SetBackground(*background_.get());
toolstrip->AddToolstripToBox(shelf_hbox_);
toolstrips_.insert(toolstrip);
model_->SetToolstripDataAt(index, toolstrip);
@@ -188,6 +194,17 @@ void ExtensionShelfGtk::Init(Profile* profile) {
model_->AddObserver(this);
}
+void ExtensionShelfGtk::InitBackground() {
+ if (background_.get())
+ return;
+ background_.reset(new SkBitmap);
+ background_->setConfig(SkBitmap::kARGB_8888_Config, 3, 3);
+ background_->allocPixels();
+ background_->eraseRGB(kBackgroundColor.red >> 8,
+ kBackgroundColor.green >> 8,
+ kBackgroundColor.blue >> 8);
+}
+
void ExtensionShelfGtk::AdjustHeight() {
if (model_->empty() || toolstrips_.empty()) {
// It's possible that |model_| is not empty, but |toolstrips_| are empty
« no previous file with comments | « chrome/browser/gtk/extension_shelf_gtk.h ('k') | chrome/browser/gtk/extension_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698