Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/browser/ui/extensions/shell_window.cc

Issue 10824204: Move small c/b/extensions classes into extensions namespace no.2 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/ui/extensions/shell_window.h" 5 #include "chrome/browser/ui/extensions/shell_window.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/extensions/shell_window_registry.h" 9 #include "chrome/browser/extensions/shell_window_registry.h"
10 #include "chrome/browser/file_select_helper.h" 10 #include "chrome/browser/file_select_helper.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 bounds(10, 10, kDefaultWidth, kDefaultHeight) { 65 bounds(10, 10, kDefaultWidth, kDefaultHeight) {
66 } 66 }
67 67
68 ShellWindow* ShellWindow::Create(Profile* profile, 68 ShellWindow* ShellWindow::Create(Profile* profile,
69 const extensions::Extension* extension, 69 const extensions::Extension* extension,
70 const GURL& url, 70 const GURL& url,
71 const ShellWindow::CreateParams& params) { 71 const ShellWindow::CreateParams& params) {
72 // This object will delete itself when the window is closed. 72 // This object will delete itself when the window is closed.
73 ShellWindow* window = 73 ShellWindow* window =
74 ShellWindow::CreateImpl(profile, extension, url, params); 74 ShellWindow::CreateImpl(profile, extension, url, params);
75 ShellWindowRegistry::Get(profile)->AddShellWindow(window); 75 extensions::ShellWindowRegistry::Get(profile)->AddShellWindow(window);
76 return window; 76 return window;
77 } 77 }
78 78
79 ShellWindow::ShellWindow(Profile* profile, 79 ShellWindow::ShellWindow(Profile* profile,
80 const extensions::Extension* extension, 80 const extensions::Extension* extension,
81 const GURL& url) 81 const GURL& url)
82 : profile_(profile), 82 : profile_(profile),
83 extension_(extension), 83 extension_(extension),
84 ALLOW_THIS_IN_INITIALIZER_LIST( 84 ALLOW_THIS_IN_INITIALIZER_LIST(
85 extension_function_dispatcher_(profile, this)) { 85 extension_function_dispatcher_(profile, this)) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 Browser* browser = browser::FindOrCreateTabbedBrowser(profile_); 228 Browser* browser = browser::FindOrCreateTabbedBrowser(profile_);
229 // Force all links to open in a new tab, even if they were trying to open a 229 // Force all links to open in a new tab, even if they were trying to open a
230 // new window. 230 // new window.
231 disposition = 231 disposition =
232 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; 232 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB;
233 chrome::AddWebContents(browser, NULL, new_contents, disposition, initial_pos, 233 chrome::AddWebContents(browser, NULL, new_contents, disposition, initial_pos,
234 user_gesture); 234 user_gesture);
235 } 235 }
236 236
237 void ShellWindow::OnNativeClose() { 237 void ShellWindow::OnNativeClose() {
238 ShellWindowRegistry::Get(profile_)->RemoveShellWindow(this); 238 extensions::ShellWindowRegistry::Get(profile_)->RemoveShellWindow(this);
239 delete this; 239 delete this;
240 } 240 }
241 241
242 string16 ShellWindow::GetTitle() const { 242 string16 ShellWindow::GetTitle() const {
243 // WebContents::GetTitle() will return the page's URL if there's no <title> 243 // WebContents::GetTitle() will return the page's URL if there's no <title>
244 // specified. However, we'd prefer to show the name of the extension in that 244 // specified. However, we'd prefer to show the name of the extension in that
245 // case, so we directly inspect the NavigationEntry's title. 245 // case, so we directly inspect the NavigationEntry's title.
246 if (!web_contents()->GetController().GetActiveEntry() || 246 if (!web_contents()->GetController().GetActiveEntry() ||
247 web_contents()->GetController().GetActiveEntry()->GetTitle().empty()) 247 web_contents()->GetController().GetActiveEntry()->GetTitle().empty())
248 return UTF8ToUTF16(extension()->name()); 248 return UTF8ToUTF16(extension()->name());
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 extension_function_dispatcher_.Dispatch(params, 352 extension_function_dispatcher_.Dispatch(params,
353 web_contents_->GetRenderViewHost()); 353 web_contents_->GetRenderViewHost());
354 } 354 }
355 355
356 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, 356 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level,
357 const std::string& message) { 357 const std::string& message) {
358 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); 358 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();
359 rvh->Send(new ExtensionMsg_AddMessageToConsole( 359 rvh->Send(new ExtensionMsg_AddMessageToConsole(
360 rvh->GetRoutingID(), level, message)); 360 rvh->GetRoutingID(), level, message));
361 } 361 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698