Home | History | Annotate | Download | only in location_bar
      1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_IMAGE_DECORATION_H_
      6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_IMAGE_DECORATION_H_
      7 #pragma once
      8 
      9 #import "base/memory/scoped_nsobject.h"
     10 #include "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h"
     11 
     12 // |LocationBarDecoration| which sizes and draws itself according to
     13 // an |NSImage|.
     14 
     15 class ImageDecoration : public LocationBarDecoration {
     16  public:
     17   ImageDecoration();
     18   virtual ~ImageDecoration();
     19 
     20   NSImage* GetImage();
     21   void SetImage(NSImage* image);
     22 
     23   // Returns the part of |frame| the image is drawn in.
     24   NSRect GetDrawRectInFrame(NSRect frame);
     25 
     26   // Implement |LocationBarDecoration|.
     27   virtual CGFloat GetWidthForSpace(CGFloat width);
     28   virtual void DrawInFrame(NSRect frame, NSView* control_view);
     29 
     30  private:
     31   scoped_nsobject<NSImage> image_;
     32 
     33   DISALLOW_COPY_AND_ASSIGN(ImageDecoration);
     34 };
     35 
     36 #endif  // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_IMAGE_DECORATION_H_
     37