summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/frame/browser_frame_chromeos.cc
blob: c0ca464ad9a72f45ced9fff1104b8f7673322301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/frame/browser_frame_chromeos.h"

#include "chrome/browser/chromeos/frame/normal_browser_frame_view.h"
#include "chrome/browser/views/frame/browser_view.h"

// static (Factory method.)
BrowserFrame* BrowserFrame::Create(BrowserView* browser_view,
                                   Profile* profile) {
  chromeos::BrowserFrameChromeos* frame =
      new chromeos::BrowserFrameChromeos(browser_view, profile);
  frame->Init();
  return frame;
}

namespace chromeos {

BrowserFrameChromeos::BrowserFrameChromeos(
    BrowserView* browser_view, Profile* profile)
    : BrowserFrameGtk(browser_view, profile) {
}

BrowserFrameChromeos::~BrowserFrameChromeos() {
}

void BrowserFrameChromeos::Init() {
  // Excludes a browser intance that requires icon/title. This is typically true
  // for dev tools and javascript console.
  // TODO(oshima): handle app panels. This currently uses the default
  // implementation, which opens Chrome's app panel instead of
  // ChromeOS's panel.
  if (!IsPanel() &&
      !browser_view()->ShouldShowWindowIcon() &&
      !browser_view()->ShouldShowWindowTitle()) {
    set_browser_frame_view(new NormalBrowserFrameView(this, browser_view()));
  }
  BrowserFrameGtk::Init();
}

bool BrowserFrameChromeos::IsMaximized() const {
  return !IsPanel() || WindowGtk::IsMaximized();
}

bool BrowserFrameChromeos::IsPanel() const {
  return browser_view()->IsBrowserTypePanel() ||
      browser_view()->IsBrowserTypePopup();
}

}  // namespace chromeos