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

Side by Side Diff: mandoline/ui/desktop_ui/toolbar_view.cc

Issue 1677293002: Bye bye Mandoline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 4 years, 10 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
« no previous file with comments | « mandoline/ui/desktop_ui/toolbar_view.h ('k') | mandoline/ui/omnibox/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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 "mandoline/ui/desktop_ui/toolbar_view.h"
6
7 #include "base/strings/string16.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "mandoline/ui/desktop_ui/browser_window.h"
10 #include "ui/views/layout/box_layout.h"
11
12 namespace mandoline {
13
14 ToolbarView::ToolbarView(BrowserWindow* browser_window)
15 : browser_window_(browser_window),
16 layout_(new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 5)),
17 back_button_(new views::LabelButton(this, base::ASCIIToUTF16("Back"))),
18 forward_button_(
19 new views::LabelButton(this, base::ASCIIToUTF16("Forward"))),
20 omnibox_launcher_(
21 new views::LabelButton(this, base::ASCIIToUTF16("Open Omnibox"))) {
22 SetLayoutManager(layout_);
23
24 AddChildView(back_button_);
25 AddChildView(forward_button_);
26 AddChildView(omnibox_launcher_);
27
28 layout_->SetDefaultFlex(0);
29 layout_->SetFlexForView(omnibox_launcher_, 1);
30 }
31
32 ToolbarView::~ToolbarView() {}
33
34 void ToolbarView::SetOmniboxText(const base::string16& text) {
35 omnibox_launcher_->SetText(text);
36 }
37
38 void ToolbarView::SetBackForwardEnabled(bool back_enabled,
39 bool forward_enabled) {
40 back_button_->SetEnabled(back_enabled);
41 forward_button_->SetEnabled(forward_enabled);
42 }
43
44 void ToolbarView::ButtonPressed(views::Button* sender, const ui::Event& event) {
45 if (sender == omnibox_launcher_)
46 browser_window_->ShowOmnibox();
47 else if (sender == back_button_)
48 browser_window_->GoBack();
49 else if (sender == forward_button_)
50 browser_window_->GoForward();
51 else
52 NOTREACHED();
53 }
54
55 } // namespace mandoline
OLDNEW
« no previous file with comments | « mandoline/ui/desktop_ui/toolbar_view.h ('k') | mandoline/ui/omnibox/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698