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

Unified Diff: athena/main/athena_frame_view.cc

Issue 544953003: Supprot V2 app: step1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 | « athena/main/athena_frame_view.h ('k') | athena/main/athena_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/main/athena_frame_view.cc
diff --git a/athena/main/athena_frame_view.cc b/athena/main/athena_frame_view.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5422a0c04825ebed49250842a77f8b5e5c7a9d6d
--- /dev/null
+++ b/athena/main/athena_frame_view.cc
@@ -0,0 +1,92 @@
+// Copyright 2014 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 "athena/main/athena_frame_view.h"
+
+#include "base/strings/utf_string_conversions.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/hit_test.h"
+#include "ui/views/background.h"
+#include "ui/views/controls/label.h"
+#include "ui/views/view.h"
+#include "ui/views/widget/widget.h"
+#include "ui/views/widget/widget_delegate.h"
+#include "ui/views/window/client_view.h"
+
+namespace athena {
+namespace {
+
+// The height of the top border necessary to display the title without the icon.
+const int kDefaultTitleHeight = 13;
+
+// The default background color for athena's frame. This is placeholder.
+const SkColor kDefaultTitleBackground = 0xFFcccccc;
+
+} // namespace
+
+// static
+const char AthenaFrameView::kViewClassName[] = "AthenaFrameView";
+
+AthenaFrameView::AthenaFrameView(views::Widget* frame) : frame_(frame) {
+ set_background(
+ views::Background::CreateSolidBackground(kDefaultTitleBackground));
+ UpdateWindowTitle();
+}
+
+AthenaFrameView::~AthenaFrameView() {
+}
+
+gfx::Rect AthenaFrameView::GetBoundsForClientView() const {
+ gfx::Rect client_bounds = bounds();
+ client_bounds.Inset(NonClientBorderInsets());
+ return client_bounds;
+}
+
+gfx::Rect AthenaFrameView::GetWindowBoundsForClientBounds(
+ const gfx::Rect& client_bounds) const {
+ gfx::Rect window_bounds = client_bounds;
+ window_bounds.Inset(-NonClientBorderInsets());
+ return window_bounds;
+}
+
+int AthenaFrameView::NonClientHitTest(const gfx::Point& point) {
+ if (!bounds().Contains(point))
+ return HTNOWHERE;
+ int client_hit_test = frame_->client_view()->NonClientHitTest(point);
+ if (client_hit_test != HTNOWHERE)
+ return client_hit_test;
+ int window_hit_test =
+ GetHTComponentForFrame(point, 0, NonClientBorderThickness(), 0, 0, false);
+ return (window_hit_test == HTNOWHERE) ? HTCAPTION : client_hit_test;
+}
+
+gfx::Size AthenaFrameView::GetPreferredSize() const {
+ gfx::Size pref = frame_->client_view()->GetPreferredSize();
+ gfx::Rect bounds(0, 0, pref.width(), pref.height());
+ return frame_->non_client_view()
+ ->GetWindowBoundsForClientBounds(bounds)
+ .size();
+}
+
+const char* AthenaFrameView::GetClassName() const {
+ return kViewClassName;
+}
+
+gfx::Insets AthenaFrameView::NonClientBorderInsets() const {
+ int border_thickness = NonClientBorderThickness();
+ return gfx::Insets(NonClientTopBorderHeight(),
+ border_thickness,
+ border_thickness,
+ border_thickness);
+}
+
+int AthenaFrameView::NonClientBorderThickness() const {
+ return 0;
+}
+
+int AthenaFrameView::NonClientTopBorderHeight() const {
+ return kDefaultTitleHeight;
+}
+
+} // namespace athena
« no previous file with comments | « athena/main/athena_frame_view.h ('k') | athena/main/athena_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698