| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/shell/shell.h" | 5 #include "content/shell/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #import "base/mac/cocoa_protocols.h" | 10 #import "base/mac/cocoa_protocols.h" |
| 11 #import "base/memory/scoped_nsobject.h" | 11 #import "base/memory/scoped_nsobject.h" |
| 12 #include "base/string_piece.h" | 12 #include "base/string_piece.h" |
| 13 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/browser/web_contents_view.h" | 15 #include "content/public/browser/web_contents_view.h" |
| 16 #include "content/shell/resource.h" | 16 #include "content/shell/resource.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 | 18 |
| 19 // Receives notification that the window is closing so that it can start the | 19 // Receives notification that the window is closing so that it can start the |
| 20 // tear-down process. Is responsible for deleting itself when done. | 20 // tear-down process. Is responsible for deleting itself when done. |
| 21 @interface ContentShellWindowDelegate : NSObject<NSWindowDelegate> { | 21 @interface ContentShellWindowDelegate : NSObject<NSWindowDelegate> { |
| 22 @private | 22 @private |
| 23 content::Shell* shell_; | 23 content::Shell* shell_; |
| 24 } | 24 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 [url_edit_view setAction:@selector(takeURLStringValueFrom:)]; | 192 [url_edit_view setAction:@selector(takeURLStringValueFrom:)]; |
| 193 [[url_edit_view cell] setWraps:NO]; | 193 [[url_edit_view cell] setWraps:NO]; |
| 194 [[url_edit_view cell] setScrollable:YES]; | 194 [[url_edit_view cell] setScrollable:YES]; |
| 195 url_edit_view_ = url_edit_view.get(); | 195 url_edit_view_ = url_edit_view.get(); |
| 196 | 196 |
| 197 // show the window | 197 // show the window |
| 198 [window_ makeKeyAndOrderFront:nil]; | 198 [window_ makeKeyAndOrderFront:nil]; |
| 199 } | 199 } |
| 200 | 200 |
| 201 void Shell::PlatformSetContents() { | 201 void Shell::PlatformSetContents() { |
| 202 NSView* web_view = tab_contents_->GetView()->GetNativeView(); | 202 NSView* web_view = web_contents_->GetView()->GetNativeView(); |
| 203 NSView* content = [window_ contentView]; | 203 NSView* content = [window_ contentView]; |
| 204 [content addSubview:web_view]; | 204 [content addSubview:web_view]; |
| 205 | 205 |
| 206 NSRect frame = [content bounds]; | 206 NSRect frame = [content bounds]; |
| 207 frame.size.height -= kURLBarHeight; | 207 frame.size.height -= kURLBarHeight; |
| 208 [web_view setFrame:frame]; | 208 [web_view setFrame:frame]; |
| 209 [web_view setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; | 209 [web_view setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; |
| 210 [web_view setNeedsDisplay:YES]; | 210 [web_view setNeedsDisplay:YES]; |
| 211 } | 211 } |
| 212 | 212 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 234 void Shell::URLEntered(std::string url_string) { | 234 void Shell::URLEntered(std::string url_string) { |
| 235 if (!url_string.empty()) { | 235 if (!url_string.empty()) { |
| 236 GURL url(url_string); | 236 GURL url(url_string); |
| 237 if (!url.has_scheme()) | 237 if (!url.has_scheme()) |
| 238 url = GURL("http://" + url_string); | 238 url = GURL("http://" + url_string); |
| 239 LoadURL(url); | 239 LoadURL(url); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace content | 243 } // namespace content |
| OLD | NEW |