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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 10407122: Get rid of the last RenderViewHostDelegate usage in chrome. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
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/extensions/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 if (!GetTabById(tab_ids[i], profile(), include_incognito(), 1520 if (!GetTabById(tab_ids[i], profile(), include_incognito(),
1521 &browser, NULL, &contents, NULL, &error_)) 1521 &browser, NULL, &contents, NULL, &error_))
1522 return false; 1522 return false;
1523 1523
1524 // Don't let the extension remove a tab if the user is dragging tabs around. 1524 // Don't let the extension remove a tab if the user is dragging tabs around.
1525 if (!browser->IsTabStripEditable()) { 1525 if (!browser->IsTabStripEditable()) {
1526 error_ = keys::kTabStripNotEditableError; 1526 error_ = keys::kTabStripNotEditableError;
1527 return false; 1527 return false;
1528 } 1528 }
1529 1529
1530 // Close the tab in this convoluted way, since there's a chance that the tab 1530 // There's a chance that the tab is being dragged, or we're in some other
1531 // is being dragged, or we're in some other nested event loop. This code 1531 // nested event loop. This code path ensures that the tab is safely closed
1532 // path should ensure that the tab is safely closed under such 1532 // under such circumstances, whereas |Browser::CloseTabContents()| does not.
1533 // circumstances, whereas |Browser::CloseTabContents()| does not. 1533 contents->web_contents()->Close();
1534 RenderViewHost* render_view_host =
1535 contents->web_contents()->GetRenderViewHost();
1536 render_view_host->GetDelegate()->Close(render_view_host);
1537 } 1534 }
1538 return true; 1535 return true;
1539 } 1536 }
1540 1537
1541 bool CaptureVisibleTabFunction::GetTabToCapture( 1538 bool CaptureVisibleTabFunction::GetTabToCapture(
1542 WebContents** web_contents, TabContentsWrapper** wrapper) { 1539 WebContents** web_contents, TabContentsWrapper** wrapper) {
1543 Browser* browser = NULL; 1540 Browser* browser = NULL;
1544 // windowId defaults to "current" window. 1541 // windowId defaults to "current" window.
1545 int window_id = extension_misc::kCurrentWindowId; 1542 int window_id = extension_misc::kCurrentWindowId;
1546 1543
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 // called for every API call the extension made. 1782 // called for every API call the extension made.
1786 GotLanguage(language); 1783 GotLanguage(language);
1787 } 1784 }
1788 1785
1789 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1786 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1790 result_.reset(Value::CreateStringValue(language.c_str())); 1787 result_.reset(Value::CreateStringValue(language.c_str()));
1791 SendResponse(true); 1788 SendResponse(true);
1792 1789
1793 Release(); // Balanced in Run() 1790 Release(); // Balanced in Run()
1794 } 1791 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_process_manager.cc ('k') | chrome/browser/media/media_stream_capture_indicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698