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

Side by Side Diff: chrome/browser/ui/views/frame/app_non_client_frame_view_aura.cc

Issue 10447053: Converts remainder of ui and chrome/browser/ui/views/frame to use ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/frame/app_non_client_frame_view_aura.h" 5 #include "chrome/browser/ui/views/frame/app_non_client_frame_view_aura.h"
6 6
7 #include "base/debug/stack_trace.h" 7 #include "base/debug/stack_trace.h"
8 #include "chrome/browser/ui/views/frame/browser_frame.h" 8 #include "chrome/browser/ui/views/frame/browser_frame.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h" 9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "grit/generated_resources.h" // Accessibility names 10 #include "grit/generated_resources.h" // Accessibility names
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 close_button_->SetAccessibleName( 63 close_button_->SetAccessibleName(
64 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); 64 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
65 restore_button_->SetAccessibleName( 65 restore_button_->SetAccessibleName(
66 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); 66 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE));
67 67
68 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 68 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
69 69
70 int control_base_resource_id = owner->browser_view()->IsOffTheRecord() ? 70 int control_base_resource_id = owner->browser_view()->IsOffTheRecord() ?
71 IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_ACTIVE : 71 IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_ACTIVE :
72 IDR_AURA_WINDOW_HEADER_BASE_ACTIVE; 72 IDR_AURA_WINDOW_HEADER_BASE_ACTIVE;
73 control_base_ = rb.GetImageNamed(control_base_resource_id).ToSkBitmap(); 73 control_base_ = rb.GetImageNamed(control_base_resource_id).ToImageSkia();
74 74
75 separator_ = 75 separator_ =
76 rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SEPARATOR).ToSkBitmap(); 76 rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SEPARATOR).ToImageSkia();
77 shadow_ = rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SHADOW).ToSkBitmap(); 77 shadow_ = rb.GetImageNamed(IDR_AURA_WINDOW_FULLSCREEN_SHADOW).ToImageSkia();
78 78
79 AddChildView(close_button_); 79 AddChildView(close_button_);
80 AddChildView(restore_button_); 80 AddChildView(restore_button_);
81 } 81 }
82 82
83 virtual void Layout() OVERRIDE { 83 virtual void Layout() OVERRIDE {
84 restore_button_->SetPosition(gfx::Point(kShadowStart, 0)); 84 restore_button_->SetPosition(gfx::Point(kShadowStart, 0));
85 close_button_->SetPosition(gfx::Point(kShadowStart + 85 close_button_->SetPosition(gfx::Point(kShadowStart +
86 restore_button_->width() - kButtonOverlap, 0)); 86 restore_button_->width() - kButtonOverlap, 0));
87 } 87 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 owner_->Close(); 129 owner_->Close();
130 } else if (sender == restore_button_) { 130 } else if (sender == restore_button_) {
131 restore_button_->SetState(views::CustomButton::BS_NORMAL); 131 restore_button_->SetState(views::CustomButton::BS_NORMAL);
132 owner_->Restore(); 132 owner_->Restore();
133 } 133 }
134 } 134 }
135 135
136 private: 136 private:
137 // Sets images whose ids are passed in for each of the respective states 137 // Sets images whose ids are passed in for each of the respective states
138 // of |button|. 138 // of |button|.
139 void SetButtonImages(views::ImageButton* button, int normal_bitmap_id, 139 void SetButtonImages(views::ImageButton* button, int normal_image_id,
140 int hot_bitmap_id, int pushed_bitmap_id) { 140 int hot_image_id, int pushed_image_id) {
141 ui::ThemeProvider* theme_provider = GetThemeProvider(); 141 ui::ThemeProvider* theme_provider = GetThemeProvider();
142 button->SetImage(views::CustomButton::BS_NORMAL, 142 button->SetImage(views::CustomButton::BS_NORMAL,
143 theme_provider->GetImageSkiaNamed(normal_bitmap_id)); 143 theme_provider->GetImageSkiaNamed(normal_image_id));
144 button->SetImage(views::CustomButton::BS_HOT, 144 button->SetImage(views::CustomButton::BS_HOT,
145 theme_provider->GetImageSkiaNamed(hot_bitmap_id)); 145 theme_provider->GetImageSkiaNamed(hot_image_id));
146 button->SetImage(views::CustomButton::BS_PUSHED, 146 button->SetImage(views::CustomButton::BS_PUSHED,
147 theme_provider->GetImageSkiaNamed(pushed_bitmap_id)); 147 theme_provider->GetImageSkiaNamed(pushed_image_id));
148 } 148 }
149 149
150 AppNonClientFrameViewAura* owner_; 150 AppNonClientFrameViewAura* owner_;
151 views::ImageButton* close_button_; 151 views::ImageButton* close_button_;
152 views::ImageButton* restore_button_; 152 views::ImageButton* restore_button_;
153 const SkBitmap* control_base_; 153 const gfx::ImageSkia* control_base_;
154 const SkBitmap* separator_; 154 const gfx::ImageSkia* separator_;
155 const SkBitmap* shadow_; 155 const gfx::ImageSkia* shadow_;
156 156
157 DISALLOW_COPY_AND_ASSIGN(ControlView); 157 DISALLOW_COPY_AND_ASSIGN(ControlView);
158 }; 158 };
159 159
160 class AppNonClientFrameViewAura::Host : public views::MouseWatcherHost { 160 class AppNonClientFrameViewAura::Host : public views::MouseWatcherHost {
161 public: 161 public:
162 explicit Host(AppNonClientFrameViewAura* owner) : owner_(owner) {} 162 explicit Host(AppNonClientFrameViewAura* owner) : owner_(owner) {}
163 virtual ~Host() {} 163 virtual ~Host() {}
164 164
165 virtual bool Contains( 165 virtual bool Contains(
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 bool AppNonClientFrameViewAura::IsShowingControls() const { 312 bool AppNonClientFrameViewAura::IsShowingControls() const {
313 return control_widget_ && control_widget_->IsVisible(); 313 return control_widget_ && control_widget_->IsVisible();
314 } 314 }
315 315
316 void AppNonClientFrameViewAura::Restore() { 316 void AppNonClientFrameViewAura::Restore() {
317 if (control_widget_) 317 if (control_widget_)
318 control_widget_->Close(); 318 control_widget_->Close();
319 mouse_watcher_.Stop(); 319 mouse_watcher_.Stop();
320 frame()->Restore(); 320 frame()->Restore();
321 } 321 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/constrained_window_views.cc ('k') | chrome/browser/ui/views/frame/app_panel_browser_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698