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

Side by Side Diff: chrome/browser/views/new_browser_window_widget.cc

Issue 126235: Adds a widget that when clicked creates a new browser window. It's not... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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
« no previous file with comments | « chrome/browser/views/new_browser_window_widget.h ('k') | views/controls/button/custom_button.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/views/new_browser_window_widget.h"
6
7 #include "app/resource_bundle.h"
8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/browser_window.h"
10 #include "chrome/browser/profile.h"
11 #include "chrome/common/page_transition_types.h"
12 #include "googleurl/src/gurl.h"
13 #include "grit/theme_resources.h"
14 #include "views/controls/button/image_button.h"
15 #include "views/fill_layout.h"
16 #include "views/widget/root_view.h"
17 #include "views/widget/widget_gtk.h"
18
19 NewBrowserWindowWidget::NewBrowserWindowWidget(Profile* profile)
20 : profile_(profile),
21 widget_(NULL) {
22 views::ImageButton* button = new views::ImageButton(this);
23 button->SetImage(views::CustomButton::BS_NORMAL,
24 ResourceBundle::GetSharedInstance().GetBitmapNamed(
25 IDR_NEW_BROWSER_WINDOW_ICON));
26 gfx::Size pref = button->GetPreferredSize();
27 views::WidgetGtk* widget =
28 new views::WidgetGtk(views::WidgetGtk::TYPE_WINDOW);
29 widget->MakeTransparent();
30 widget->Init(NULL, gfx::Rect(0, 0, pref.width(), pref.height()), false);
31 widget->GetRootView()->SetLayoutManager(new views::FillLayout());
32 widget->GetRootView()->AddChildView(button);
33 // TODO: set window type.
34 widget_ = widget;
35 widget->Show();
36 }
37
38 NewBrowserWindowWidget::~NewBrowserWindowWidget() {
39 widget_->Close();
40 widget_ = NULL;
41 }
42
43 void NewBrowserWindowWidget::ButtonPressed(views::Button* sender) {
44 Browser* browser = Browser::Create(profile_);
45 browser->AddTabWithURL(GURL(), GURL(), PageTransition::START_PAGE,
46 true, -1, false, NULL);
47 browser->window()->Show();
48 }
OLDNEW
« no previous file with comments | « chrome/browser/views/new_browser_window_widget.h ('k') | views/controls/button/custom_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698