#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
-#include "chrome/browser/autocomplete/autocomplete_match.h"
-#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/favicon/favicon_tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/metrics/proto/omnibox_event.pb.h"
+#include "components/omnibox/autocomplete_match.h"
#include "components/url_fixer/url_fixer.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/navigation_controller.h"
// Make a new tab. Load the contents of this tab from the nib and associate
// the new controller with |contents| so it can be looked up later.
- const BOOL autoEmbedFullscreen =
- implicit_cast<content::WebContentsDelegate*>(browser_)->
- EmbedsFullscreenWidget();
base::scoped_nsobject<TabContentsController> contentsController(
- [[TabContentsController alloc] initWithContents:contents
- andAutoEmbedFullscreen:autoEmbedFullscreen]);
+ [[TabContentsController alloc] initWithContents:contents]);
[tabContentsArray_ insertObject:contentsController atIndex:index];
// Make a new tab and add it to the strip. Keep track of its controller.
// Simply create a new TabContentsController for |newContents| and place it
// into the array, replacing |oldContents|. An ActiveTabChanged notification
// will follow, at which point we will install the new view.
- const BOOL autoEmbedFullscreen =
- implicit_cast<content::WebContentsDelegate*>(browser_)->
- EmbedsFullscreenWidget();
base::scoped_nsobject<TabContentsController> newController(
- [[TabContentsController alloc] initWithContents:newContents
- andAutoEmbedFullscreen:autoEmbedFullscreen]);
+ [[TabContentsController alloc] initWithContents:newContents]);
// Bye bye, |oldController|.
[tabContentsArray_ replaceObjectAtIndex:index withObject:newController];
// View hierarchy of the contents view:
// NSView -- switchView, same for all tabs
// +- NSView -- TabContentsController's view
- // +- TabContentsViewCocoa
+ // +- WebContentsViewCocoa
//
// Changing it? Do not forget to modify
// -[TabStripController swapInTabAtIndex:] too.
return [web_contents->GetNativeView() superview];
}
+
+NSRect GetSheetParentBoundsForParentView(NSView* view) {
+ // If the devtools view is open, it shrinks the size of the WebContents, so go
+ // up the hierarchy to the devtools container view to avoid that. Note that
+ // the devtools view is always in the hierarchy even if it is not open or it
+ // is detached.
+ NSView* devtools_view = [[[view superview] superview] superview];
+ return [devtools_view convertRect:[devtools_view bounds] toView:nil];
+}