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

Side by Side Diff: chrome/browser/ui/panels/panel.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/panels/panel.h" 5 #include "chrome/browser/ui/panels/panel.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 PanelExtensionWindowController(Panel* panel, Profile* profile); 59 PanelExtensionWindowController(Panel* panel, Profile* profile);
60 ~PanelExtensionWindowController() override; 60 ~PanelExtensionWindowController() override;
61 61
62 // Overridden from extensions::WindowController. 62 // Overridden from extensions::WindowController.
63 int GetWindowId() const override; 63 int GetWindowId() const override;
64 std::string GetWindowTypeText() const override; 64 std::string GetWindowTypeText() const override;
65 base::DictionaryValue* CreateWindowValueWithTabs( 65 base::DictionaryValue* CreateWindowValueWithTabs(
66 const extensions::Extension* extension) const override; 66 const extensions::Extension* extension) const override;
67 base::DictionaryValue* CreateTabValue(const extensions::Extension* extension, 67 base::DictionaryValue* CreateTabValue(const extensions::Extension* extension,
68 int tab_index) const override; 68 int tab_index) const override;
69 scoped_ptr<extensions::api::tabs::Tab> CreateTabObject( 69 std::unique_ptr<extensions::api::tabs::Tab> CreateTabObject(
70 const extensions::Extension* extension, 70 const extensions::Extension* extension,
71 int tab_index) const override; 71 int tab_index) const override;
72 bool CanClose(Reason* reason) const override; 72 bool CanClose(Reason* reason) const override;
73 void SetFullscreenMode(bool is_fullscreen, 73 void SetFullscreenMode(bool is_fullscreen,
74 const GURL& extension_url) const override; 74 const GURL& extension_url) const override;
75 bool IsVisibleToExtension( 75 bool IsVisibleToExtension(
76 const extensions::Extension* extension) const override; 76 const extensions::Extension* extension) const override;
77 77
78 private: 78 private:
79 Panel* panel_; // Weak pointer. Owns us. 79 Panel* panel_; // Weak pointer. Owns us.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 result->Set(extensions::tabs_constants::kTabsKey, tab_list); 111 result->Set(extensions::tabs_constants::kTabsKey, tab_list);
112 } 112 }
113 return result; 113 return result;
114 } 114 }
115 115
116 base::DictionaryValue* PanelExtensionWindowController::CreateTabValue( 116 base::DictionaryValue* PanelExtensionWindowController::CreateTabValue(
117 const extensions::Extension* extension, int tab_index) const { 117 const extensions::Extension* extension, int tab_index) const {
118 return CreateTabObject(extension, tab_index)->ToValue().release(); 118 return CreateTabObject(extension, tab_index)->ToValue().release();
119 } 119 }
120 120
121 scoped_ptr<extensions::api::tabs::Tab> 121 std::unique_ptr<extensions::api::tabs::Tab>
122 PanelExtensionWindowController::CreateTabObject( 122 PanelExtensionWindowController::CreateTabObject(
123 const extensions::Extension* extension, 123 const extensions::Extension* extension,
124 int tab_index) const { 124 int tab_index) const {
125 if (tab_index > 0) 125 if (tab_index > 0)
126 return nullptr; 126 return nullptr;
127 127
128 content::WebContents* web_contents = panel_->GetWebContents(); 128 content::WebContents* web_contents = panel_->GetWebContents();
129 if (!web_contents) 129 if (!web_contents)
130 return nullptr; 130 return nullptr;
131 131
132 scoped_ptr<extensions::api::tabs::Tab> tab_object( 132 std::unique_ptr<extensions::api::tabs::Tab> tab_object(
133 new extensions::api::tabs::Tab); 133 new extensions::api::tabs::Tab);
134 tab_object->id.reset(new int(SessionTabHelper::IdForTab(web_contents))); 134 tab_object->id.reset(new int(SessionTabHelper::IdForTab(web_contents)));
135 tab_object->index = 0; 135 tab_object->index = 0;
136 tab_object->window_id = 136 tab_object->window_id =
137 SessionTabHelper::IdForWindowContainingTab(web_contents); 137 SessionTabHelper::IdForWindowContainingTab(web_contents);
138 tab_object->url.reset(new std::string(web_contents->GetURL().spec())); 138 tab_object->url.reset(new std::string(web_contents->GetURL().spec()));
139 tab_object->status.reset( 139 tab_object->status.reset(
140 new std::string(extensions::ExtensionTabUtil::GetTabStatusText( 140 new std::string(extensions::ExtensionTabUtil::GetTabStatusText(
141 web_contents->IsLoading()))); 141 web_contents->IsLoading())));
142 tab_object->active = panel_->IsActive(); 142 tab_object->active = panel_->IsActive();
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 // static 904 // static
905 void Panel::FormatTitleForDisplay(base::string16* title) { 905 void Panel::FormatTitleForDisplay(base::string16* title) {
906 size_t current_index = 0; 906 size_t current_index = 0;
907 size_t match_index; 907 size_t match_index;
908 while ((match_index = title->find(L'\n', current_index)) != 908 while ((match_index = title->find(L'\n', current_index)) !=
909 base::string16::npos) { 909 base::string16::npos) {
910 title->replace(match_index, 1, base::string16()); 910 title->replace(match_index, 1, base::string16());
911 current_index = match_index; 911 current_index = match_index;
912 } 912 }
913 } 913 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698