Home | History | Annotate | Download | only in extensions
      1 // Copyright 2014 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_RENDERER_EXTENSIONS_NOTIFICATIONS_NATIVE_HANDLER_H_
      6 #define CHROME_RENDERER_EXTENSIONS_NOTIFICATIONS_NATIVE_HANDLER_H_
      7 
      8 #include "base/compiler_specific.h"
      9 #include "extensions/renderer/object_backed_native_handler.h"
     10 
     11 namespace base {
     12 class Value;
     13 }
     14 
     15 namespace extensions {
     16 
     17 class NotificationsNativeHandler : public ObjectBackedNativeHandler {
     18  public:
     19   explicit NotificationsNativeHandler(ScriptContext* context);
     20 
     21  private:
     22   // This implements notifications_private.GetImageSizes() which
     23   // informs the renderer of the actual rendered size of each
     24   // component of a notification.  It additionally includes
     25   // information about the system's maximum scale factor so that
     26   // larger images specified in DP can be interpreted as scaled
     27   // versions of the DIP size.
     28   //   * |args| is used only to get the return value.
     29   //   * The return value contains the following keys:
     30   //         scaleFactor - a float a la devicePixelRatio
     31   //         icon - a dictionary with integer keys "height" and "width" (DIPs)
     32   //         image - a dictionary of the same format as |icon|
     33   //         buttonIcon - a dictionary of the same format as |icon|
     34   void GetNotificationImageSizes(
     35       const v8::FunctionCallbackInfo<v8::Value>& args);
     36 
     37   DISALLOW_COPY_AND_ASSIGN(NotificationsNativeHandler);
     38 };
     39 
     40 }  // namespace extensions
     41 
     42 #endif  // CHROME_RENDERER_EXTENSIONS_NOTIFICATIONS_NATIVE_HANDLER_H_
     43