Home | History | Annotate | Download | only in cocoa
      1 // Copyright (c) 2012 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_DEV_TOOLS_CONTROLLER_H_
      6 #define CHROME_BROWSER_UI_COCOA_DEV_TOOLS_CONTROLLER_H_
      7 
      8 #import <Cocoa/Cocoa.h>
      9 
     10 #include "base/mac/scoped_nsobject.h"
     11 #include "chrome/browser/devtools/devtools_window.h"
     12 
     13 @class FocusTracker;
     14 @class GraySplitView;
     15 class Profile;
     16 
     17 namespace content {
     18 class WebContents;
     19 }
     20 
     21 // A class that handles updates of the devTools view within a browser window.
     22 // It swaps in the relevant devTools contents for a given WebContents or removes
     23 // the view, if there's no devTools contents to show.
     24 @interface DevToolsController : NSObject<NSSplitViewDelegate> {
     25  @private
     26   // A view hosting docked devTools contents.
     27   base::scoped_nsobject<GraySplitView> splitView_;
     28 
     29   DevToolsDockSide dockSide_;
     30 
     31   // Docked devtools window instance. NULL when current tab is not inspected
     32   // or is inspected with undocked version of DevToolsWindow.
     33   DevToolsWindow* devToolsWindow_;
     34 
     35   base::scoped_nsobject<FocusTracker> focusTracker_;
     36 }
     37 
     38 - (id)init;
     39 
     40 // This controller's view.
     41 - (NSView*)view;
     42 
     43 // The compiler seems to have trouble handling a function named "view" that
     44 // returns an NSSplitView, so provide a differently-named method.
     45 - (NSSplitView*)splitView;
     46 
     47 // Depending on |contents|'s state, decides whether the docked web inspector
     48 // should be shown or hidden and adjusts its height (|delegate_| handles
     49 // the actual resize).
     50 - (void)updateDevToolsForWebContents:(content::WebContents*)contents
     51                          withProfile:(Profile*)profile;
     52 
     53 @end
     54 
     55 #endif  // CHROME_BROWSER_UI_COCOA_DEV_TOOLS_CONTROLLER_H_
     56